弹性搜索版本 5.4.3
我使用单例来创建一个客户端,这里是主要代码
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);
}
Run Code Online (Sandbox Code Playgroud)
第一次运行到代码“tclient = new PreBuiltTransportClient(settings);”时,抛出异常
IllegalStateException:availableProcessors 已设置为 [4]
但是第二次调用它会成功,并且客户端将被终止,有人知道如何解决它吗?