Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [osgi-users] OSGi DS field-option question
  • From: "Fauth Dirk (ETAS/ENA)" <dirk.fauth@xxxxxxxxxxxx>
  • Date: Mon, 13 Jun 2022 13:50:27 +0000
  • Accept-language: en-US
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=de.bosch.com; dmarc=pass action=none header.from=de.bosch.com; dkim=pass header.d=de.bosch.com; arc=none
  • Arc-message-signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=AmMeF/y+/BevabeNdhppChkwcb0OPcvjo6jfw+PX9UI=; b=lM6fLMf0RDBbAtDW/HM0bKIQFevfEWjw1yobp3ZCY2cP4r4p8So/m0t2SB8lX041Zx0qhihWIqJyEwRaHrZqKBksmnRR8S0CcjOsdgWsVqTevSiaHp9p5F+6q5vtvvbRW8k9gj505jFEEMg3lu262unxVZ7E77et5+owtaG40d1qLGQFFqegrvTD3d8UdZH80QmdkDolB34YdilkGHkHhJ3hOp+OqnsTp3PanytQ4VXyaorhVJVxcdrFzGC9Do1APCLBww9X3255DrasKn+n7SMMyKkUB7GD1eCpjkHwx0EoycTi1l1AkZwaPmpRSjKuxNswQjXWg2l7aBSddrM3cg==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=A5kT517/D0V7A1QEsmtliA1LdvWduPcXmAyix84pifq4gLw1Lv5LGBVyEobE2vw/v4b/jCy0s2g8/rlcNDRN51hShubkPinG2bgN2bklb8vOhGdCT8geKICe7lYgpO37yGLRGJXOlwAQcE0ZT84YAuknrg5f3fIaWzM0IK7Y3v2CbaZGm/0mBA417bZ1g3CiTLbhb2YUo+cd9wN8vPxjQbwY+DIwkqbb6+l3hpFT7XmfzzUvncJGlcD1u7ugeXSNBH4vcLZLlmWdyeGYCPQeim9zGfDyPZ0LJlf5YA/kyFngSAr8qmW3BSb/lyjSIg0EHmyIDUvl5bA5ET+FpDRO4g==
  • Delivered-to: osgi-users@xxxxxxxxxxx
  • List-archive: <https://dev.eclipse.org/mailman/private/osgi-users/>
  • List-help: <mailto:osgi-users-request@eclipse.org?subject=help>
  • List-subscribe: <https://dev.eclipse.org/mailman/listinfo/osgi-users>, <mailto:osgi-users-request@eclipse.org?subject=subscribe>
  • List-unsubscribe: <https://dev.eclipse.org/mailman/options/osgi-users>, <mailto:osgi-users-request@eclipse.org?subject=unsubscribe>
  • Thread-index: Adh8r+Bnr9k2HZg0R7+AtAr/cUXRdQAGZCGeAJiTw5A=
  • Thread-topic: OSGi DS field-option question

Hi,

 

While setting up a minimal example to reproduce the issue, I came across an old blog post of mine that explained the behavior.

 

This is what I have noted down in my blog post.

“If you do not specify a modified life cycle method, the Component Configuration is deactivated and afterwards activated again with the new configuration object.”

 

Looking into the specification, this is covered in chapter 112.5.14 Modification.

https://docs.osgi.org/specification/osgi.cmpn/8.0.0/service.component.html#service.component-modification

 

After I added a modified life cycle event method, the behavior that the component instance is kept works as expected. No bug, the problem was sitting between keyboard and chair. 😉

 

Mit freundlichen Grüßen / Best regards

Dirk Fauth

ETAS Advance Engineering

T +49 711 3423-2174
Dirk.Fauth@xxxxxxxx

ETAS GmbH, ETAS/ENA
Borsigstraße 24, 70469 Stuttgart, Germany
www.etas.com

ETAS – Empowering Tomorrow’s Automotive Software


Managing Directors: Christoph Hartung, Günter Gromeier, Götz Nigge
Chairman of the Supervisory Board: Dr. Walter Schirm
Registered Office: Stuttgart, Registration Court: Amtsgericht Stuttgart, HRB: 19033

Von: osgi-users <osgi-users-bounces@xxxxxxxxxxx> Im Auftrag von Thomas Watson
Gesendet: Freitag, 10. Juni 2022 15:01
An: This is a community mail list for OSGi technology. Any OSGi technical discussion or questions are acceptable here. <osgi-users@xxxxxxxxxxx>
Betreff: Re: [osgi-users] OSGi DS field-option question

 

At first glance this appears to be a bug.  I suggest you open an issue against Felix SCR (assuming that is what you use).   Be sure to include an example to reproduce.  Before that, ensure that the cardinality is set to 0..n in the component XML that is generated.

 

Tom

 


From: osgi-users <osgi-users-bounces@xxxxxxxxxxx> on behalf of Fauth Dirk (ETAS/ENA) via osgi-users <osgi-users@xxxxxxxxxxx>
Sent: Friday, June 10, 2022 5:13 AM
To: This is a community mail list for OSGi technology. Any OSGi technical discussion or questions are acceptable here. <osgi-users@xxxxxxxxxxx>
Cc: Fauth Dirk (ETAS/ENA) <dirk.fauth@xxxxxxxxxxxx>
Subject: [EXTERNAL] [osgi-users] OSGi DS field-option question

 

Hi, I am trying to create a service that stores some other service references and exchange them based on a target property. @Component(service = StringModifierRegistry.class) public class StringModifierRegistry { ‍ ‍ ‍ ‍ ‍ ‍ ‍ ‍ ‍ ‍ ‍ ‍ ‍ ‍ ‍ ‍ ‍ ‍ ‍ ‍ ‍ ‍ ‍ ‍ ‍ ‍ ‍

ZjQcmQRYFpfptBannerStart

This Message Is From an External Sender

This message came from outside your organization.

 

ZjQcmQRYFpfptBannerEnd

Hi,

 

I am trying to create a service that stores some other service references and exchange them based on a target property.

 

@Component(service = StringModifierRegistry.class)

public class StringModifierRegistry {

 

      @Reference(target = "(!(service.intents=jaxrs))", policy = ReferencePolicy.DYNAMIC)

      final List<StringModifier> stringModifier = new CopyOnWriteArrayList<>();

     

      @Activate

      void activate() {

             System.out.println("registry activated");

      }

     

      @Deactivate

      void deactivate() {

             System.out.println("registry deactivated");

      }

     

      public List<StringModifier> getStringModifier() {

             return this.stringModifier;

      }

}

 

Since the policy is DYNAMIC and the list is final which leads to field-option="update" I would have expected that the list is updated and not replaced if I change the target filter via ConfigurationAdmin. But what I see is that the component gets deactivated and activated whenever I update the configuration.

Switching to event binding also causes deactivate and activate. Maybe it is then not related to the collection update, but I am not sure.

 

Is the deactivate and activate caused by the configuration update of the target target property or because the bound services change? I haven’t found a passage in the specification on that topic. But maybe I looked in the wrong sections.

 

Mit freundlichen Grüßen / Best regards

Dirk Fauth

ETAS Advance Engineering

T +49 711 3423-2174
Dirk.Fauth@xxxxxxxx

ETAS GmbH, ETAS/ENA
Borsigstraße 24, 70469 Stuttgart, Germany
www.etas.com

ETAS – Empowering Tomorrow’s Automotive Software


Managing Directors: Christoph Hartung, Günter Gromeier, Götz Nigge
Chairman of the Supervisory Board: Dr. Walter Schirm
Registered Office: Stuttgart, Registration Court: Amtsgericht Stuttgart, HRB: 19033


Back to the top