Unfortunately there is no addedService (after the fact) callback. I think 
that would definitely be useful. For R5 we are looking at many changes 
including generics support. We should add addedService then.

Until then, since OSGi provides the ServiceTracker source code under 
Apache License, you could copy the code into your own package (that is, 
refactor to a package other than org.osgi.*) and add the addedService 
callback.
-- 

BJ Hargrave
Senior Technical Staff Member, IBM
OSGi Fellow and CTO of the OSGi Alliance
[email protected]

office: +1 386 848 1781
mobile: +1 386 848 3788




From:
Will Horn <[email protected]>
To:
[email protected]
Date:
2009/08/29 19:34
Subject:
[osgi-dev] Staying up to date with the highest ranked instance of a 
service
Sent by:
[email protected]



ServiceTracker#getService() is essentially the functionality I'm looking 
for.  The only extra bit I need is to receive a callback when the result 
changes.  Is there a good way to do this?  I have tried subclassing 
ServiceTracker but addingService, for example, is called before the 
service is added to the tracker (rightly so, given its intention) so 
getService() does not reflect the new value.

Thanks,
Will_______________________________________________
OSGi Developer Mail List
[email protected]
https://mail.osgi.org/mailman/listinfo/osgi-dev
_______________________________________________
OSGi Developer Mail List
[email protected]
https://mail.osgi.org/mailman/listinfo/osgi-dev

Reply via email to