[ 
https://issues.apache.org/jira/browse/METRON-1853?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16674122#comment-16674122
 ] 

ASF GitHub Bot commented on METRON-1853:
----------------------------------------

Github user mmiklavc commented on a diff in the pull request:

    https://github.com/apache/metron/pull/1251#discussion_r230560963
  
    --- Diff: 
metron-stellar/stellar-common/src/main/java/org/apache/metron/stellar/dsl/functions/resolver/BaseFunctionResolver.java
 ---
    @@ -94,6 +95,16 @@ public void initialize(Context context) {
         this.context = context;
       }
     
    +  /**
    +   * Close the Stellar functions.
    +   */
    +  @Override
    +  public void close() throws IOException {
    +    for (StellarFunctionInfo info : getFunctionInfo()) {
    --- End diff --
    
    What about something like this?
    ```
    public void close() throws IOException {
        Map<String, Throwable> errors = new HashMap();
        for (StellarFunctionInfo info : getFunctionInfo()) {
          try {
            info.getFunction().close();
          } catch (Throwable t) {
            errors.put(info.getName(), t);
          }
        }
        if (!errors.isEmpty()) {
          StringBuilder sb = new StringBuilder();
          sb.append("Unable to close Stellar functions:");
          for (Map.Entry<String, Throwable> e : errors.entrySet()) {
            Throwable throwable = e.getValue();
            String eText = String
                .format("Exception - Function: %s; Message: %s; Cause: %s", 
e.getKey(), throwable .getMessage(),
                    throwable .getCause());
            sb.append(System.lineSeparator());
            sb.append(eText);
          }
          throw new IOException(sb.toString());
        }
      }
    ```


> Add shutdown hook to Stellar BaseFunctionResolver
> -------------------------------------------------
>
>                 Key: METRON-1853
>                 URL: https://issues.apache.org/jira/browse/METRON-1853
>             Project: Metron
>          Issue Type: Improvement
>            Reporter: Michael Miklavcic
>            Assignee: Michael Miklavcic
>            Priority: Major
>




--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Reply via email to