Hi, 
I am after some advice on the following. 

In general terms the problem is if a new instance of a service is created via a 
programatic call to ConfigurationAdmin.createFactoryConfiguration(), what 
options do I have to determine that this new service instance has been 
activated considering the call to .createFactoryConfiguration() returns 
immediately. 

I have tried setting up a service tracker with a filter for the specific 
instance of the service but I am not sure I understand the expected behavior of 
the .waitForService() method. For a small timeout period e.g. 1ms the call to 
.waitForService() returns with a null service as I would expect. For a longer 
timeout period e.g. 1000ms the call to .waitForService() returns with non null 
service and from the logs I can see that it seems to return only after the 
tracked service has returned from the @Activate method, is this the expected 
behavior? 
I also tried adding a sleep for 0.5 sec in the @Activate method of the tracked 
service and the .waitForService() still only returned after the @Activate 
method of that service had returned. Does the registration of a service have 
any dependency on its activation in the context of Declarative Services? Note 
the tracked service has @Component(immediate = true) 

Although the behavior is what I am after ie .waitForService() only seems to 
return after the tracked service has activated I am wondering if I am just 
getting lucky in this case. 
Regards, 
Tim Jones 


        
_______________________________________________
OSGi Developer Mail List
osgi-dev@mail.osgi.org
https://mail.osgi.org/mailman/listinfo/osgi-dev

Reply via email to