小编Ash*_*her的帖子

创建 elasticsearch 客户端抛出一个 netty IllegalStateException

弹性搜索版本 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]

但是第二次调用它会成功,并且客户端将被终止,有人知道如何解决它吗?

java netty elasticsearch

4
推荐指数
1
解决办法
2793
查看次数

标签 统计

elasticsearch ×1

java ×1

netty ×1