Hi
That's more a question about the OSGi core implementation than about Felix,
but anyway: does anyone know the difference between the
two constructors:
ServiceTracker(BundleContext context, Filter filter,
ServiceTrackerCustomizer customizer)
and
ServiceTracker(BundleContext context, String clazz,
ServiceTrackerCustomizer customizer)
?
I know the first one takes a full filter and the second simply a class, and
I was expecting to simply see in the implementation
this(context, context.createFilter("(objectClass="+clazz), customizer)
for the second one, but that's not the case.
If you use the 1st constructor it seems that the ServiceTracker is actually
registering a listener for ALL services and doing the filtering itself in
the
listener callback whereas the 2nd constructor strictly listens for services
implementing the given class.
That looks weird to me - why not use the
BundleContext.addServiceListener(listener, filter) with a valid filter in
both cases ?
So - is there a performance penalty to use the 1st constructor when you're
actually simply tracking classes ?
Gurus ?
/jog