use of org.apache.stanbol.enhancer.servicesapi.impl.ChainsTracker in project stanbol by apache.
the class ChainsRootResource method activate.
@Activate
public void activate(ComponentContext ctx) {
final BundleContext bc = ctx.getBundleContext();
chainTracker = new ChainsTracker(ctx.getBundleContext(), Collections.<String>emptySet(), new ServiceTrackerCustomizer() {
@Override
public Object addingService(ServiceReference reference) {
Object service = bc.getService(reference);
if (service != null) {
//rebuild the cache on the next call
_chainCache = null;
}
return service;
}
@Override
public void modifiedService(ServiceReference reference, Object service) {
//rebuild the cache on the next call
_chainCache = null;
}
@Override
public void removedService(ServiceReference reference, Object service) {
if (reference != null) {
bc.ungetService(reference);
//rebuild the cache on the next call
_chainCache = null;
}
}
});
chainTracker.open();
}
Aggregations