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