quintinali commented on a change in pull request #17: SDAP-72
URL: 
https://github.com/apache/incubator-sdap-mudrod/pull/17#discussion_r189108815
 
 

 ##########
 File path: core/src/main/java/org/apache/sdap/mudrod/driver/ESDriver.java
 ##########
 @@ -473,12 +474,20 @@ protected Client makeClient(Properties props) throws 
IOException {
 
     Client client = null;
 
-    // Prefer TransportClient
+    // Prefer to TransportClient
     if (hosts != null && port > 1) {
-      TransportClient transportClient = new ESTransportClient(settings);
-      for (String host : hosts)
-        transportClient.addTransportAddress(new 
InetSocketTransportAddress(InetAddress.getByName(host), port));
-      client = transportClient;
+      TransportClient transportClient = null;
+      try {
 
 Review comment:
   @lewismc, I don't want to close the client in this function. If I change the 
code to 
   
   if (hosts != null && port > 1) {  
         try (TransportClient transportClient = new 
ESTransportClient(settings)) {
           for (String host : hosts){
             transportClient.addTransportAddress(new 
InetSocketTransportAddress(InetAddress.getByName(host), port));
           }
           client = transportClient;
         }
       }
   
   An error occurs as following:
   java.lang.IllegalStateException: transport client is closed
        at 
org.elasticsearch.client.transport.TransportClientNodesService.execute(TransportClientNodesService.java:240)
        at 
org.elasticsearch.client.transport.TransportProxyClient.execute(TransportProxyClient.java:59)
        at 
org.elasticsearch.client.transport.TransportClient.doExecute(TransportClient.java:356)
        at 
org.elasticsearch.client.support.AbstractClient.execute(AbstractClient.java:403)
        at 
org.elasticsearch.client.support.AbstractClient$IndicesAdmin.execute(AbstractClient.java:1226)
        at 
org.elasticsearch.action.ActionRequestBuilder.execute(ActionRequestBuilder.java:80)
        at 
org.elasticsearch.action.ActionRequestBuilder.execute(ActionRequestBuilder.java:54)
        at org.apache.sdap.mudrod.driver.ESDriver.putMapping(ESDriver.java:142)
        at 
org.apache.sdap.mudrod.discoveryengine.MudrodAbstract.initMudrod(MudrodAbstract.java:84)
        at 
org.apache.sdap.mudrod.discoveryengine.MudrodAbstract.<init>(MudrodAbstract.java:56)
        at 
org.apache.sdap.mudrod.discoveryengine.DiscoveryEngineAbstract.<init>(DiscoveryEngineAbstract.java:29)
        at 
org.apache.sdap.mudrod.discoveryengine.WeblogDiscoveryEngine.<init>(WeblogDiscoveryEngine.java:50)
        at 
org.apache.sdap.mudrod.main.MudrodEngine.startFullIngest(MudrodEngine.java:242)
        at org.apache.sdap.mudrod.main.MudrodEngine.main(MudrodEngine.java:388)
   

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services

Reply via email to