Github user mattf-horton commented on a diff in the pull request:

    https://github.com/apache/metron/pull/530#discussion_r133529473
  
    --- Diff: 
bundles-lib/src/main/java/org/apache/metron/bundles/ExtensionManager.java ---
    @@ -103,61 +104,52 @@ private ExtensionManager(){}
       /**
        * @return The singleton instance of the ExtensionManager
        */
    -  public static ExtensionManager getInstance() {
    -    ExtensionManager result = extensionManager;
    -    if (result == null) {
    -      synchronized (ExtensionManager.class) {
    -        result = extensionManager;
    -        if (result == null) {
    -          extensionManager = new ExtensionManager();
    -          result = extensionManager;
    -        }
    +  public static ExtensionManager getInstance() throws 
NotInitializedException {
    +    synchronized (ExtensionManager.class) {
    +      if (extensionManager == null) {
    +        throw new NotInitializedException("ExtensionManager not 
initialized");
           }
    +      return extensionManager;
         }
    -    return result;
       }
    --- End diff --
    
    As with BundleClassLoader, to deal with extensionManager atomically:
    ```java
      public static ExtensionManager getInstance() throws 
NotInitializedException {
        ExtensionManager result = extensionManager;
        if (result == null) {
          throw new NotInitializedException("ExtensionManager 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.
---

Reply via email to