use of org.osgi.framework.SynchronousBundleListener in project eclipse.platform.runtime by eclipse.
the class OSGiObjectSupplier method track.
private void track(final Bundle bundle, final IRequestor requestor) {
// A _synchronous_ BundleListener asserts that the BC is un-injected,
// _before_ it becomes invalid (state-wise).
BundleListener listener = new SynchronousBundleListener() {
@Override
public void bundleChanged(BundleEvent event) {
if (event.getBundle().equals(bundle)) {
if (requestor.isValid()) {
requestor.resolveArguments(false);
requestor.execute();
}
}
}
};
synchronized (requestor2listener) {
localBundleContext.addBundleListener(listener);
requestor2listener.put(requestor, listener);
}
}
Aggregations