Spec Experts; The specification for BundleContext.addServiceListener says that if we change the service property, the whole lifecycle will NOT be seen by the listener.
I can't find the clarity in the ServiceTracker specification. It says; "When a service is being added to the ServiceTracker object or when a tracked service is modified or removed from the ServiceTracker object, it must call addingService, modifiedService or reovedService respectively, on the ServcieTrackerCustomizer object..." However, it is unclear what "added to..." refers to, and what the real intent really is. I provide a tracking filter to the ServiceTracker that uses service properties; (&(objectClass=org.hedhman.MyService)(habba=abc)) IMHO, if I change the property "habba" of myService from "def" to "abc" the ServiceTrackerCustomizer.addedService() should[1] be called for the above tracker. Likewise, if the filter of the tracking 'looses' the service, then removedService() should be called. I.e. modifiedService would only be called if service properties are changed, but the filter is still evaluating true. This is significantly different from what is descibed in the BundleContext.addServiceListener, and may be considered both "incompatible" as well as "complicated", but it makes sense for the user. In either case, I think the documentation should be complemented with a diagram of the full cycle. Cheers Niclas [1] I have actually not tried this yet, but it is part of upcoming work this week. Looking at the ServiceTracker source, I get the impression that only the services that initially match the filter will be considered at all. _______________________________________________ OSGi Developer Mail List [email protected] http://www2.osgi.org/mailman/listinfo/osgi-dev
