Fix NPE being thrown intermittently in shutdown process
@@ -298,7 +298,9 @@ public class SiddhiExtensionLoader {
});
bundleExtensions.entrySet().removeIf(entry -> entry.getValue() ==
bundle.getBundleId());
- ClassLoader classLoader = bundle.adapt(BundleWiring.class).getClassLoader();
+ BundleWiring bundleWiring = bundle.adapt(BundleWiring.class);
+ if (bundleWiring != null) {
+ ClassLoader classLoader = bundleWiring.getClassLoader();
Iterable<Class<?>> extensions = ClassIndex.getAnnotated(Extension.class, classLoader);
for (Class extension : extensions) {
Extension siddhiExtensionAnnotation = (Extension) extension.getAnnotation(Extension.class);
@@ -306,7 +308,7 @@ public class SiddhiExtensionLoader {
String key = siddhiExtensionAnnotation.namespace() + SiddhiConstants.EXTENSION_SEPARATOR +
siddhiExtensionAnnotation.name();
removeFromExtensionHolderMap(key, extension, extensionHolderConcurrentHashMap);
-
+ }
}
}
}
