// Synchronous listeners first
iterator = registrations.iterator();
while (iterator.hasNext()) {
BundleListenerRegistration blreg = iterator.next();
ModuleListener listener = blreg.listener;
try {
if (listener instanceof SynchronousModuleListener) {
iterator.remove();
listener.moduleChanged(event);
}
} catch (Throwable th) {
LOGGER.warn("Error while firing module event " + typeName + " for: " + module, th);
}
}
if (!registrations.isEmpty()) {
Runnable runner = new Runnable() {
@Override
public void run() {
// BundleListeners are called with a BundleEvent object when a moduleState has been
// installed, resolved, started, stopped, updated, unresolved, or uninstalled
if (asyncBundleEvents.contains(type)) {
for (BundleListenerRegistration blreg : registrations) {
ModuleListener listener = blreg.listener;
try {
if (!(listener instanceof SynchronousModuleListener)) {
listener.moduleChanged(event);
}
} catch (Throwable th) {
LOGGER.warn("Error while firing module event " + typeName + " for: " + module, th);
}
}