if (listener instanceof SynchronousBundleListener) {
framework.checkAdminPermission(getBundle(), AdminPermission.LISTENER);
synchronized (framework.bundleEventSync) {
if (bundleEventSync == null) {
bundleEventSync = new EventListeners();
framework.bundleEventSync.addListener(this, this);
}
bundleEventSync.addListener(listener, listener);
}
} else {
synchronized (framework.bundleEvent) {
if (bundleEvent == null) {
bundleEvent = new EventListeners();
framework.bundleEvent.addListener(this, this);
}
bundleEvent.addListener(listener, listener);
}