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

    https://github.com/apache/metron/pull/1250#discussion_r230227817
  
    --- Diff: 
metron-platform/metron-common/src/main/java/org/apache/metron/common/bolt/ConfiguredEnrichmentBolt.java
 ---
    @@ -17,18 +17,41 @@
      */
     package org.apache.metron.common.bolt;
     
    +import java.io.IOException;
     import java.lang.invoke.MethodHandles;
    +import java.util.Map;
    +
    +import org.apache.http.impl.client.CloseableHttpClient;
     import org.apache.metron.common.configuration.EnrichmentConfigurations;
    +import org.apache.metron.stellar.common.utils.HttpClientUtils;
    +import org.apache.storm.task.OutputCollector;
    +import org.apache.storm.task.TopologyContext;
     import org.slf4j.Logger;
     import org.slf4j.LoggerFactory;
     
     public abstract class ConfiguredEnrichmentBolt extends 
ConfiguredBolt<EnrichmentConfigurations> {
     
       private static final Logger LOG = 
LoggerFactory.getLogger(MethodHandles.lookup().lookupClass());
     
    +  protected CloseableHttpClient httpClient;
     
       public ConfiguredEnrichmentBolt(String zookeeperUrl) {
         super(zookeeperUrl, "ENRICHMENT");
       }
     
    +  @Override
    +  public void prepare(Map stormConf, TopologyContext context, 
OutputCollector collector) {
    +    super.prepare(stormConf, context, collector);
    --- End diff --
    
    I tried that initially but realized there is no shutdown hook in Stellar.  
HttpClient objects need to be closed and the only hook that exists is in the 
bolts.  
    
    If we did have a way to close it, I would be in favor of managing it in the 
function.  If we decide it's worth adding that hook in Stellar (I think we 
should as a follow on) we can easily move this inside the function.


---

Reply via email to