If you use something like Declarative Services, iPOJO, Dependency
Manager, etc., then you can get these sorts of dependencies managed for
you automatically.
Otherwise, your proposed solution sounds like it would work too.
-> richard
Aggelos Mpimpoudis wrote:
Xmmm...the answer is exactly in this paragraph...
<http://dev.eclipse.org/newslists/news.eclipse.technology.equinox/msg03240.html>
If you need to wait for more than one service then you could use a
ServiceTracker with a Filter and a ServiceTrackerCustomizer to notify
your main thread but that is more complicated work. You could also
use a separate ServiceTracker for each service but that can get costly.
But I cannot figure out an elegant solution ... grrrr
Aggelos
Aggelos Mpimpoudis wrote:
Hello, OSGi community.
Here is my question. I have an OSGi service, that I want to
initialize it's facilities only when 3 other services are added to
the framework. I construct 3 service trackers (each one for every
needed service). How can I proceed after obtaining the knowledge that
the 3 services are ready? I am thinking of keeping a map maintained
and at every add and remove of service to check map's size and only
if it is of size 3, to proceed with the thread's execution. Is this
practice very naive? Is there something more obvious that I am missing?
Thank you!
My Best Regards,
Aggelos Mpimpoudis
_______________________________________________
OSGi Developer Mail List
[email protected]
http://www2.osgi.org/mailman/listinfo/osgi-dev