Github user mattf-horton commented on a diff in the pull request: https://github.com/apache/metron/pull/530#discussion_r133522636 --- Diff: bundles-lib/src/main/java/org/apache/metron/bundles/BundleClassLoaders.java --- @@ -73,19 +73,15 @@ private BundleClassLoaders() { /** * @return The singleton instance of the BundleClassLoaders + * @throws NotInitializedException if BundleClassLoaders has not been init'd */ - public static BundleClassLoaders getInstance() { - BundleClassLoaders result = bundleClassLoaders; - if (result == null) { - synchronized (BundleClassLoaders.class) { - result = bundleClassLoaders; - if (result == null) { - bundleClassLoaders = new BundleClassLoaders(); - result = bundleClassLoaders; - } + public static BundleClassLoaders getInstance() throws NotInitializedException { + synchronized (BundleClassLoaders.class) { + if (bundleClassLoaders == null) { + throw new NotInitializedException("BundleClassLoaders not initialized"); } + return bundleClassLoaders; } - return result; } --- End diff -- There's no longer a need for getInstance() to synchronize, if we deal with bundleClassLoader atomically. (See also init() method comment below): ```java public static BundleClassLoaders getInstance() throws NotInitializedException { BundleClassLoaders result = bundleClassLoaders; if (result == null) { throw new NotInitializedException("BundleClassLoaders not initialized"); } return result; } ```
--- 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. ---