Tutorial :ServiceTracker in OSGi r4.1


Im using a org.osgi.util.tracker.ServiceTracker (PrintableServiceTracker implements ServiceTrackerCustomizer and simply prints when a new service is added).

Filter filter = bc.createFilter("(objectClass=se.enea.print.Printable)");              tracker = new ServiceTracker(bc, filter, new PrintableServiceTracker(bc));  

I've read about "pseudo registration" in the new ebook "OSGi in action" and I wonder if I have to do pseudo registration explicitly or if the framwork handles this automatically?

(Will already installed Printable services be caught by the ServiceTracker. will ServiceTracker.addingService(ServiceReference) be called for each of the pre installed Printable services)


Not sure what pseudo registration means, but the method addingService in PrintableServiceTracker will be called not only for new services but also for existing services.

Note:If u also have question or solution just comment us below or mail us on toontricks1994@gmail.com
Next Post »