Zookeeper客户端连接池

时间:2017-05-23 09:16:21

标签: connection-pooling apache-zookeeper apache-curator

目前我正在为每个请求使用singleton zookeeper客户端,这可能不是很好的性能。 我想实现zookeeper客户端连接池。如果有任何

,请有人分享示例

当我为我的应用程序使用单个实例时,请参阅以下日志中的异常

[http-8082-1​​6-SendThread(10.35.1.205:2181)] INFO org.apache.zookeeper.ClientCnxn - 客户端会话超时,在2666ms没有收到来自sessionid 0x15b157263300002的服务器,关闭套接字连接并尝试重新连接 [http-8082-1​​6-EventThread] INFO org.apache.curator.framework.state.ConnectionStateManager - 状态更改:SUSPENDED [http-8082-1​​6-EventThread] ERROR org.apache.curator.framework.imps.CuratorFrameworkImpl - 后台异常无法重试或重试放弃 java.lang.IllegalStateException:未启动客户端     在com.google.common.base.Preconditions.checkState(Preconditions.java:176)     在org.apache.curator.CuratorZookeeperClient.getZooKeeper(CuratorZookeeperClient.java:113)     在org.apache.curator.framework.imps.CuratorFrameworkImpl.performBackgroundOperation(CuratorFrameworkImpl.java:821)     at org.apache.curator.framework.imps.CuratorFrameworkImpl.doSyncForSuspendedConnection(CuratorFrameworkImpl.java:696)     在org.apache.curator.framework.imps.CuratorFrameworkImpl.suspendConnection(CuratorFrameworkImpl.java:669)     在org.apache.curator.framework.imps.CuratorFrameworkImpl.validateConnection(CuratorFrameworkImpl.java:616)     在org.apache.curator.framework.imps.CuratorFrameworkImpl.processEvent(CuratorFrameworkImpl.java:861)     在org.apache.curator.framework.imps.CuratorFrameworkImpl.access $ 000(CuratorFrameworkImpl.java:63)     在org.apache.curator.framework.imps.CuratorFrameworkImpl $ 1.process(CuratorFrameworkImpl.java:108)     在org.apache.curator.ConnectionState.process(ConnectionState.java:162)     在org.apache.zookeeper.ClientCnxn $ EventThread.processEvent(ClientCnxn.java:522)     在org.apache.zookeeper.ClientCnxn $ EventThread.run(ClientCnxn.java:498) 2017-05-17 15:34:54,377 [Thread-88] DEBUG - 查找配置:feed.masterthread.refresh.delaytime.minutes [http-8082-1​​6-EventThread] INFO org.apache.zookeeper.ClientCnxn - EventThread关闭 [Curator-ConnectionStateManager-0] INFO org.apache.zookeeper.ZooKeeper - Session:0x15b157263300002已关闭

0 个答案:

没有答案