2017-07-15 81 views
0

elasticsearch版本5.4.3創建elasticsearch客戶端拋出一個網狀IllegalStateException異常

我用單創建客戶端,這裏是主代碼

TransportClient tclient = null; 
    if (clusterName != null) { 
      Settings settings = Settings.builder() 
        .put("cluster.name",clusterName) 
        .put("client.transport.sniff", true) 
        .build(); 
      tclient = new PreBuiltTransportClient(settings);//here will throw the exception 
    } else { 
     tclient = new PreBuiltTransportClient(Settings.EMPTY); 
    } 

當第一次運行的代碼「tclient =新PreBuiltTransportClient(設置)」,它拋出一個異常

IllegalStateException: availableProcessors is already set to [4]

但調用第二它將蘇連接和客戶端將被終止, 任何人都知道如何解決它?

回答

相關問題