metron-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mattf-horton <...@git.apache.org>
Subject [GitHub] metron pull request #530: METRON-777 Metron Extension System and Parser Exte...
Date Wed, 16 Aug 2017 18:44:57 GMT
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 infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

Mime
View raw message