Hi,
I am using Declarative Services in Apache Karaf 4.1.3. I notice that in all
@Component using @Reference with policy DYNAMIC on attributes cause
Component deactivate on service changes. This is an example:
@Component(immediate = true)
public class Test3 {
private static final Logger logger =
LoggerFactory.getLogger(Test3.class);
private GreetService greetService;
@Activate
public void activate(BundleContext bundleContext) {
logger.info("activate() - IN - input: bundleContext = [{}]",
bundleContext);
logger.info("activate() - OUT");
}
@Deactivate
public void deactivate() {
logger.info("deactivate() - IN");
logger.info("deactivate() - OUT");
}
// ----------------------------- greet service
--------------------------------- //
@Reference(policy = ReferencePolicy.DYNAMIC, policyOption =
ReferencePolicyOption.GREEDY)
public void setGreetService(GreetService greetService) {
logger.info("setGreetService() - NOTIFY - msg: greetService =
[{}]",
greetService);
this.greetService = greetService;
}
public void unsetGreetService(GreetService greetService) {
logger.info("unsetGreetService() - NOTIFY - msg: greetService =
[{}]",
greetService);
}
public GreetService getGreetService() {
return greetService;
}
}
When I deactivate GreetService I'd like to unset it in method
unsetGreetService() without DISABLE the entire component calling
deactivate() method. Is this possible? I am able to obtain this behaviour
only with @Reference properties DYNAMIC and MULTIPLE. Thanks for help.
Marco
--
Sent from:
http://apache-felix.18485.x6.nabble.com/Apache-Felix-Users-f4833200.html
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]