Github user mattf-horton commented on a diff in the pull request: https://github.com/apache/metron/pull/530#discussion_r133527688 --- Diff: bundles-lib/src/main/java/org/apache/metron/bundles/BundleClassLoaders.java --- @@ -121,33 +109,18 @@ private void unInit() { * @throws IllegalStateException when already initialized with a given set of extension directories * and extensionDirs does not match */ - public void init(final FileSystemManager fileSystemManager, final List<FileObject> extensionsDirs, + public static void init(final FileSystemManager fileSystemManager, final List<FileObject> extensionsDirs, BundleProperties props) throws FileSystemException, ClassNotFoundException, URISyntaxException { if (extensionsDirs == null || fileSystemManager == null) { throw new NullPointerException("cannot have empty arguments"); } - InitContext ic = initContext; - if (ic == null) { - synchronized (this) { - ic = initContext; - if (ic == null) { - initContext = load(fileSystemManager, extensionsDirs, props); - ic = initContext; - } - } - } else { - boolean matching = CollectionUtils - .isEqualCollection(initContext.extensionDirs, extensionsDirs); - if (!matching) { - throw new IllegalStateException( - "Cannot reinitialize and extension directories cannot change"); - } - matching = initContext.properties.match(props); - if (!matching) { - throw new IllegalStateException( - "Cannot re-initialize and properties cannot change"); + synchronized (BundleClassLoaders.class) { + if (bundleClassLoaders != null) { + throw new IllegalStateException("BundleClassloader already exists"); } + bundleClassLoaders = new BundleClassLoaders(); + initContext = bundleClassLoaders.load(fileSystemManager, extensionsDirs, props); --- End diff -- So that getInstance() can safely not synchronize, do this: ```java BundleClassLoaders b = new BundleClassLoaders(); InitContext ic = b.load(fileSystemManager, extensionsDirs, props); initContext = ic; bundleClassLoaders = b; ```
--- If your project is set up for it, you can reply to this email and have your reply appear on GitHub as well. If your project does not have this feature enabled and wishes so, or if the feature is enabled but not working, please contact infrastructure at infrastruct...@apache.org or file a JIRA ticket with INFRA. ---