利用zookeeper节点特效,有序性,最先处理最小的节点
<dependency>
<groupId>org.apache.curator</groupId>
<artifactId>curator-framework</artifactId>
<version>4.1.0</version>
</dependency>
<dependency>
<groupId>org.apache.curator</groupId>
<artifactId>curator-recipes</artifactId>
<version>4.1.0</version>
</dependency>
核心代码实现
public class CustomizeQueue {
private static final String CONNECT_IP_PORT = "176.16.0.135:2181";
private static final Logger logger = LoggerFactory.getLogger(DistributedQueueExample.class);
private static final String PATH = "/example/customize-queue";
public static void main(String[] args) throws Exception {
CuratorFramework curatorFramework = CuratorFrameworkFactory.builder().connectString(CONNECT_IP_PORT)
.sessionTimeoutMs(5000).connectionTimeoutMs(5000).retryPolicy(new ExponentialBackoffRetry(1000, 3))
.build();
curatorFramework.start();
// 消费者监听事件[这里采用服务器主动推模式,主动拉不实现了]
PathChildrenCache childrenCache = new PathChildrenCache(curatorFramework, PATH, true);
childrenCache.start(PathChildrenCache.StartMode.NORMAL);
childrenCache.getListenable().addListener((client, event) -> {
switch (event.getType()) {
case CHILD_ADDED:
// 接收到节点新增,这里还需要判断新增节点前是否 还有更小的节点,有可能因为网络等,没有处理之前的请求
SortedSet<String> childrens = new TreeSet<>(client.getChildren().forPath(PATH));
// 这些都是比当前节点小的有序队列
String absolutePath = event.getData().getPath();
SortedSet<String> headSet = childrens.headSet(absolutePath.substring(absolutePath.indexOf("/") + 1));
// 接收到订单请求,处理完毕需要将zk节点移除
for (String node : headSet) {
String currentPath = PATH + "/" + node;
String orderId = new String(client.getData().forPath(currentPath));
try {
logger.debug("新增节点,接收到创建订单请求,开始处理订单: {}", orderId);
client.delete().forPath(currentPath);
} catch (Exception e) {
logger.debug("当前节点为:{}, 节点出现异常:【{}】,本次跳过处理订单: {}", node, e.getMessage(), orderId);
continue;
}
}
break;
case CHILD_REMOVED:
String orderId = new String(event.getData().getData());
logger.debug("处理订单成功,移除订单,当前订单号为:{}, 节点为:{}", orderId, event.getData().getPath());
break;
default:
break;
}
});
// 生产者
for (int i = 0; i < 10; i++) {
new Thread(()->{
String orderId = generateString(18);
String sequencePath = PATH + "/";
String forPath;
try {
forPath = curatorFramework.create().withMode(CreateMode.PERSISTENT_SEQUENTIAL)
.forPath(sequencePath, orderId.getBytes());
logger.debug("生产者,创建节点:{}, 订单号:{}", forPath, orderId);
} catch (Exception e) {
e.printStackTrace();
}
}).start();
}
System.in.read();
childrenCache.close();
curatorFramework.close();
}
public static final String allChar = "0123456789";
// 模拟产生一个订单
public static String generateString(int length) {
StringBuffer sb = new StringBuffer();
Random random = new Random();
for (int i = 0; i < length; i++) {
sb.append(allChar.charAt(random.nextInt(allChar.length())));
}
return sb.toString();
}
}
分析一下执行过程就明白了,这里日志打印很详细
2019-1-22 11:59:57[ INFO](Compatibility.java:41) Running in ZooKeeper 3.4.x compatibility mode
2019-1-22 11:59:57[ INFO](CuratorFrameworkImpl.java:308) Starting
2019-1-22 11:59:57[DEBUG](CuratorZookeeperClient.java:230) Starting
2019-1-22 11:59:57[DEBUG](ConnectionState.java:109) Starting
2019-1-22 11:59:57[DEBUG](ConnectionState.java:197) reset
2019-1-22 12:00:02[ INFO](Environment.java:100) Client environment:zookeeper.version=3.4.13-2d71af4dbe22557fda74f9a9b4309b15a7487f03, built on 06/29/2018 00:39 GMT
2019-1-22 12:00:02[ INFO](Environment.java:100) Client environment:host.name=momo
2019-1-22 12:00:02[ INFO](Environment.java:100) Client environment:java.version=1.8.0_131
2019-1-22 12:00:02[ INFO](Environment.java:100) Client environment:java.vendor=Oracle Corporation
2019-1-22 12:00:02[ INFO](Environment.java:100) Client environment:java.home=C:\Program Files\Java\jre1.8.0_131
2019-1-22 12:00:02[ INFO](Environment.java:100) Client environment:java.class.path=C:\TempData\my-workspace\zookeeperuse\target\classes;C:\TempData\maven-workspace\org\apache\zookeeper\zookeeper\3.4.13\zookeeper-3.4.13.jar;C:\TempData\maven-workspace\org\slf4j\slf4j-api\1.7.25\slf4j-api-1.7.25.jar;C:\TempData\maven-workspace\org\slf4j\slf4j-log4j12\1.7.25\slf4j-log4j12-1.7.25.jar;C:\TempData\maven-workspace\log4j\log4j\1.2.17\log4j-1.2.17.jar;C:\TempData\maven-workspace\jline\jline\0.9.94\jline-0.9.94.jar;C:\TempData\maven-workspace\org\apache\yetus\audience-annotations\0.5.0\audience-annotations-0.5.0.jar;C:\TempData\maven-workspace\io\netty\netty\3.10.6.Final\netty-3.10.6.Final.jar;C:\TempData\maven-workspace\com\101tec\zkclient\0.11\zkclient-0.11.jar;C:\TempData\maven-workspace\org\apache\curator\curator-framework\4.1.0\curator-framework-4.1.0.jar;C:\TempData\maven-workspace\org\apache\curator\curator-client\4.1.0\curator-client-4.1.0.jar;C:\TempData\maven-workspace\com\google\guava\guava\20.0\guava-20.0.jar;C:\TempData\maven-workspace\org\apache\curator\curator-recipes\4.1.0\curator-recipes-4.1.0.jar
2019-1-22 12:00:02[ INFO](Environment.java:100) Client environment:java.library.path=C:\Program Files\Java\jre1.8.0_131\bin;C:\WINDOWS\Sun\Java\bin;C:\WINDOWS\system32;C:\WINDOWS;C:/Program Files/Java/jre1.8.0_131/bin/server;C:/Program Files/Java/jre1.8.0_131/bin;C:/Program Files/Java/jre1.8.0_131/lib/amd64;C:\ProgramData\Oracle\Java\javapath;C:\Program Files (x86)\Intel\iCLS Client\;C:\Program Files\Intel\iCLS Client\;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\WINDOWS\System32\WindowsPowerShell\v1.0\;C:\Program Files (x86)\Intel\Intel(R) Management Engine Components\DAL;C:\Program Files\Intel\Intel(R) Management Engine Components\DAL;C:\Program Files (x86)\Intel\Intel(R) Management Engine Components\IPT;C:\Program Files\Intel\Intel(R) Management Engine Components\IPT;C:\Program Files\TortoiseSVN\bin;C:\tools\apache-maven-3.5.4\bin;C:\Program Files\Java\jdk1.8.0_131\bin;C:\Program Files\Java\jdk1.8.0_131\lib;C:\Program Files\Java\jdk1.8.0_131\lib\tools.jar;C:\tools\apache-maven-3.5.4\bin\;C:\Program Files\MySQL\MySQL Server 5.5\bin;C:\Program Files\Git\cmd;C:\Program Files\Java\jre1.8.0_131\lib;C:\Program Files\Java\jre1.8.0_131\bin;C:\tools\apache-tomcat-6.0.48\bin;;C:\Program Files (x86)\OpenGrADS\Contents\Cygwin\Versions2.0.a9.oga.1\i686;C:\Users\it\AppData\Local\Microsoft\WindowsApps;C:\tools\eclipse-64;;.
2019-1-22 12:00:02[ INFO](Environment.java:100) Client environment:java.io.tmpdir=C:\Users\it\AppData\Local\Temp\
2019-1-22 12:00:02[ INFO](Environment.java:100) Client environment:java.compiler=<NA>
2019-1-22 12:00:02[ INFO](Environment.java:100) Client environment:os.name=Windows 10
2019-1-22 12:00:02[ INFO](Environment.java:100) Client environment:os.arch=amd64
2019-1-22 12:00:02[ INFO](Environment.java:100) Client environment:os.version=10.0
2019-1-22 12:00:02[ INFO](Environment.java:100) Client environment:user.name=it
2019-1-22 12:00:02[ INFO](Environment.java:100) Client environment:user.home=C:\Users\it
2019-1-22 12:00:02[ INFO](Environment.java:100) Client environment:user.dir=C:\TempData\my-workspace\zookeeperuse
2019-1-22 12:00:02[ INFO](ZooKeeper.java:442) Initiating client connection, connectString=176.16.0.135:2181 sessionTimeout=5000 watcher=org.apache.curator.ConnectionState@96532d6
2019-1-22 12:00:02[DEBUG](ClientCnxn.java:120) zookeeper.disableAutoWatchReset is false
2019-1-22 12:00:02[ INFO](CuratorFrameworkImpl.java:350) Default schema
2019-1-22 12:00:07[ INFO](ClientCnxn.java:1029) Opening socket connection to server 176.16.0.135/176.16.0.135:2181. Will not attempt to authenticate using SASL (unknown error)
2019-1-22 12:00:07[ INFO](ClientCnxn.java:879) Socket connection established to 176.16.0.135/176.16.0.135:2181, initiating session
2019-1-22 12:00:07[DEBUG](ClientCnxn.java:952) Session establishment request sent on 176.16.0.135/176.16.0.135:2181
2019-1-22 12:00:07[ INFO](ClientCnxn.java:1303) Session establishment complete on server 176.16.0.135/176.16.0.135:2181, sessionid = 0x1000001a10c0016, negotiated timeout = 5000
2019-1-22 12:00:07[DEBUG](ConnectionState.java:177) Negotiated session timeout: 5000
2019-1-22 12:00:07[ INFO](ConnectionStateManager.java:237) State change: CONNECTED
2019-1-22 12:00:07[DEBUG](CuratorFrameworkImpl.java:1016) Clearing sleep for 0 operations
2019-1-22 12:00:07[DEBUG](ClientCnxn.java:846) Reading reply sessionid:0x1000001a10c0016, packet:: clientPath:null serverPath:null finished:false header:: 1,1 replyHeader:: 1,29563,0 request:: '/example/customize-queue/,#303533373635353731333830343635393236,v{s{31,s{'world,'anyone}}},2 response:: '/example/customize-queue/0000000308
2019-1-22 12:00:07[DEBUG](ClientCnxn.java:846) Reading reply sessionid:0x1000001a10c0016, packet:: clientPath:null serverPath:null finished:false header:: 2,1 replyHeader:: 2,29564,0 request:: '/example/customize-queue/,#393333313534323939333837393036303734,v{s{31,s{'world,'anyone}}},2 response:: '/example/customize-queue/0000000309
2019-1-22 12:00:07[DEBUG](CustomizeQueue.java:71) 生产者,创建节点:/example/customize-queue/0000000308, 订单号:053765571380465926
2019-1-22 12:00:07[DEBUG](ClientCnxn.java:846) Reading reply sessionid:0x1000001a10c0016, packet:: clientPath:null serverPath:null finished:false header:: 3,3 replyHeader:: 3,29564,0 request:: '/example,F response:: s{26942,26942,1547974121480,1547974121480,0,13,0,0,2,3,27287}
2019-1-22 12:00:07[DEBUG](ClientCnxn.java:846) Reading reply sessionid:0x1000001a10c0016, packet:: clientPath:null serverPath:null finished:false header:: 4,1 replyHeader:: 4,29565,0 request:: '/example/customize-queue/,#373137343836393039363030373639333834,v{s{31,s{'world,'anyone}}},2 response:: '/example/customize-queue/0000000310
2019-1-22 12:00:07[DEBUG](ClientCnxn.java:846) Reading reply sessionid:0x1000001a10c0016, packet:: clientPath:null serverPath:null finished:false header:: 5,1 replyHeader:: 5,29566,0 request:: '/example/customize-queue/,#313036303631373233323538303632333038,v{s{31,s{'world,'anyone}}},2 response:: '/example/customize-queue/0000000311
2019-1-22 12:00:07[DEBUG](CustomizeQueue.java:71) 生产者,创建节点:/example/customize-queue/0000000309, 订单号:933154299387906074
2019-1-22 12:00:07[DEBUG](ClientCnxn.java:846) Reading reply sessionid:0x1000001a10c0016, packet:: clientPath:null serverPath:null finished:false header:: 6,1 replyHeader:: 6,29567,0 request:: '/example/customize-queue/,#373938303239383435303932303038363435,v{s{31,s{'world,'anyone}}},2 response:: '/example/customize-queue/0000000312
2019-1-22 12:00:07[DEBUG](CustomizeQueue.java:71) 生产者,创建节点:/example/customize-queue/0000000310, 订单号:717486909600769384
2019-1-22 12:00:07[DEBUG](CustomizeQueue.java:71) 生产者,创建节点:/example/customize-queue/0000000312, 订单号:798029845092008645
2019-1-22 12:00:07[DEBUG](CustomizeQueue.java:71) 生产者,创建节点:/example/customize-queue/0000000311, 订单号:106061723258062308
2019-1-22 12:00:07[DEBUG](ClientCnxn.java:846) Reading reply sessionid:0x1000001a10c0016, packet:: clientPath:null serverPath:null finished:false header:: 7,1 replyHeader:: 7,29568,0 request:: '/example/customize-queue/,#303330313634393738323434353030373432,v{s{31,s{'world,'anyone}}},2 response:: '/example/customize-queue/0000000313
2019-1-22 12:00:07[DEBUG](CustomizeQueue.java:71) 生产者,创建节点:/example/customize-queue/0000000313, 订单号:030164978244500742
2019-1-22 12:00:07[DEBUG](ClientCnxn.java:846) Reading reply sessionid:0x1000001a10c0016, packet:: clientPath:null serverPath:null finished:false header:: 8,1 replyHeader:: 8,29569,0 request:: '/example/customize-queue/,#363331373330353537373830363636343434,v{s{31,s{'world,'anyone}}},2 response:: '/example/customize-queue/0000000314
2019-1-22 12:00:07[DEBUG](CustomizeQueue.java:71) 生产者,创建节点:/example/customize-queue/0000000314, 订单号:631730557780666444
2019-1-22 12:00:07[DEBUG](ClientCnxn.java:846) Reading reply sessionid:0x1000001a10c0016, packet:: clientPath:null serverPath:null finished:false header:: 9,1 replyHeader:: 9,29570,0 request:: '/example/customize-queue/,#333632323832363439373537323233313334,v{s{31,s{'world,'anyone}}},2 response:: '/example/customize-queue/0000000315
2019-1-22 12:00:07[DEBUG](CustomizeQueue.java:71) 生产者,创建节点:/example/customize-queue/0000000315, 订单号:362282649757223134
2019-1-22 12:00:07[DEBUG](ClientCnxn.java:846) Reading reply sessionid:0x1000001a10c0016, packet:: clientPath:null serverPath:null finished:false header:: 10,1 replyHeader:: 10,29571,0 request:: '/example/customize-queue/,#333136373835373839353034343736383637,v{s{31,s{'world,'anyone}}},2 response:: '/example/customize-queue/0000000316
2019-1-22 12:00:07[DEBUG](CustomizeQueue.java:71) 生产者,创建节点:/example/customize-queue/0000000316, 订单号:316785789504476867
2019-1-22 12:00:07[DEBUG](ClientCnxn.java:846) Reading reply sessionid:0x1000001a10c0016, packet:: clientPath:null serverPath:null finished:false header:: 11,1 replyHeader:: 11,29572,0 request:: '/example/customize-queue/,#383636363735303037383438373537343434,v{s{31,s{'world,'anyone}}},2 response:: '/example/customize-queue/0000000317
2019-1-22 12:00:07[DEBUG](CustomizeQueue.java:71) 生产者,创建节点:/example/customize-queue/0000000317, 订单号:866675007848757444
2019-1-22 12:00:07[DEBUG](ClientCnxn.java:846) Reading reply sessionid:0x1000001a10c0016, packet:: clientPath:null serverPath:null finished:false header:: 12,3 replyHeader:: 12,29572,0 request:: '/example/customize-queue,F response:: s{27043,27043,1547994570434,1547994570434,0,626,0,0,3,10,29572}
2019-1-22 12:00:07[DEBUG](ClientCnxn.java:846) Reading reply sessionid:0x1000001a10c0016, packet:: clientPath:null serverPath:null finished:false header:: 13,3 replyHeader:: 13,29572,-101 request:: '/example/customize-queue/foo,F response::
2019-1-22 12:00:07[DEBUG](ClientCnxn.java:846) Reading reply sessionid:0x1000001a10c0016, packet:: clientPath:/example/customize-queue serverPath:/example/customize-queue finished:false header:: 14,12 replyHeader:: 14,29572,0 request:: '/example/customize-queue,T response:: v{'0000000311,'0000000310,'0000000313,'0000000312,'0000000315,'0000000314,'0000000317,'0000000316,'0000000308,'0000000309},s{27043,27043,1547994570434,1547994570434,0,626,0,0,3,10,29572}
2019-1-22 12:00:07[DEBUG](ClientCnxn.java:846) Reading reply sessionid:0x1000001a10c0016, packet:: clientPath:/example/customize-queue serverPath:/example/customize-queue finished:false header:: 15,12 replyHeader:: 15,29572,0 request:: '/example/customize-queue,T response:: v{'0000000311,'0000000310,'0000000313,'0000000312,'0000000315,'0000000314,'0000000317,'0000000316,'0000000308,'0000000309},s{27043,27043,1547994570434,1547994570434,0,626,0,0,3,10,29572}
2019-1-22 12:00:07[DEBUG](ClientCnxn.java:846) Reading reply sessionid:0x1000001a10c0016, packet:: clientPath:/example/customize-queue/0000000311 serverPath:/example/customize-queue/0000000311 finished:false header:: 16,4 replyHeader:: 16,29572,0 request:: '/example/customize-queue/0000000311,T response:: #313036303631373233323538303632333038,s{29566,29566,1548129606797,1548129606797,0,0,0,0,18,0,29566}
2019-1-22 12:00:07[DEBUG](ClientCnxn.java:846) Reading reply sessionid:0x1000001a10c0016, packet:: clientPath:/example/customize-queue/0000000310 serverPath:/example/customize-queue/0000000310 finished:false header:: 17,4 replyHeader:: 17,29572,0 request:: '/example/customize-queue/0000000310,T response:: #373137343836393039363030373639333834,s{29565,29565,1548129606797,1548129606797,0,0,0,0,18,0,29565}
2019-1-22 12:00:07[DEBUG](ClientCnxn.java:846) Reading reply sessionid:0x1000001a10c0016, packet:: clientPath:/example/customize-queue/0000000313 serverPath:/example/customize-queue/0000000313 finished:false header:: 18,4 replyHeader:: 18,29572,0 request:: '/example/customize-queue/0000000313,T response:: #303330313634393738323434353030373432,s{29568,29568,1548129606797,1548129606797,0,0,0,0,18,0,29568}
2019-1-22 12:00:07[DEBUG](ClientCnxn.java:846) Reading reply sessionid:0x1000001a10c0016, packet:: clientPath:/example/customize-queue/0000000312 serverPath:/example/customize-queue/0000000312 finished:false header:: 19,4 replyHeader:: 19,29572,0 request:: '/example/customize-queue/0000000312,T response:: #373938303239383435303932303038363435,s{29567,29567,1548129606797,1548129606797,0,0,0,0,18,0,29567}
2019-1-22 12:00:07[DEBUG](ClientCnxn.java:846) Reading reply sessionid:0x1000001a10c0016, packet:: clientPath:/example/customize-queue/0000000315 serverPath:/example/customize-queue/0000000315 finished:false header:: 20,4 replyHeader:: 20,29572,0 request:: '/example/customize-queue/0000000315,T response:: #333632323832363439373537323233313334,s{29570,29570,1548129606798,1548129606798,0,0,0,0,18,0,29570}
2019-1-22 12:00:07[DEBUG](ClientCnxn.java:846) Reading reply sessionid:0x1000001a10c0016, packet:: clientPath:/example/customize-queue/0000000314 serverPath:/example/customize-queue/0000000314 finished:false header:: 21,4 replyHeader:: 21,29572,0 request:: '/example/customize-queue/0000000314,T response:: #363331373330353537373830363636343434,s{29569,29569,1548129606798,1548129606798,0,0,0,0,18,0,29569}
2019-1-22 12:00:07[DEBUG](ClientCnxn.java:846) Reading reply sessionid:0x1000001a10c0016, packet:: clientPath:/example/customize-queue/0000000317 serverPath:/example/customize-queue/0000000317 finished:false header:: 22,4 replyHeader:: 22,29572,0 request:: '/example/customize-queue/0000000317,T response:: #383636363735303037383438373537343434,s{29572,29572,1548129606798,1548129606798,0,0,0,0,18,0,29572}
2019-1-22 12:00:07[DEBUG](ClientCnxn.java:846) Reading reply sessionid:0x1000001a10c0016, packet:: clientPath:/example/customize-queue/0000000316 serverPath:/example/customize-queue/0000000316 finished:false header:: 23,4 replyHeader:: 23,29572,0 request:: '/example/customize-queue/0000000316,T response:: #333136373835373839353034343736383637,s{29571,29571,1548129606798,1548129606798,0,0,0,0,18,0,29571}
2019-1-22 12:00:07[DEBUG](ClientCnxn.java:846) Reading reply sessionid:0x1000001a10c0016, packet:: clientPath:/example/customize-queue/0000000308 serverPath:/example/customize-queue/0000000308 finished:false header:: 24,4 replyHeader:: 24,29572,0 request:: '/example/customize-queue/0000000308,T response:: #303533373635353731333830343635393236,s{29563,29563,1548129606797,1548129606797,0,0,0,0,18,0,29563}
2019-1-22 12:00:07[DEBUG](ClientCnxn.java:846) Reading reply sessionid:0x1000001a10c0016, packet:: clientPath:/example/customize-queue/0000000309 serverPath:/example/customize-queue/0000000309 finished:false header:: 25,4 replyHeader:: 25,29572,0 request:: '/example/customize-queue/0000000309,T response:: #393333313534323939333837393036303734,s{29564,29564,1548129606797,1548129606797,0,0,0,0,18,0,29564}
2019-1-22 12:00:07[DEBUG](ClientCnxn.java:846) Reading reply sessionid:0x1000001a10c0016, packet:: clientPath:/example/customize-queue/0000000311 serverPath:/example/customize-queue/0000000311 finished:false header:: 26,4 replyHeader:: 26,29572,0 request:: '/example/customize-queue/0000000311,T response:: #313036303631373233323538303632333038,s{29566,29566,1548129606797,1548129606797,0,0,0,0,18,0,29566}
2019-1-22 12:00:07[DEBUG](ClientCnxn.java:846) Reading reply sessionid:0x1000001a10c0016, packet:: clientPath:/example/customize-queue/0000000310 serverPath:/example/customize-queue/0000000310 finished:false header:: 27,4 replyHeader:: 27,29572,0 request:: '/example/customize-queue/0000000310,T response:: #373137343836393039363030373639333834,s{29565,29565,1548129606797,1548129606797,0,0,0,0,18,0,29565}
2019-1-22 12:00:07[DEBUG](ClientCnxn.java:846) Reading reply sessionid:0x1000001a10c0016, packet:: clientPath:/example/customize-queue/0000000313 serverPath:/example/customize-queue/0000000313 finished:false header:: 28,4 replyHeader:: 28,29572,0 request:: '/example/customize-queue/0000000313,T response:: #303330313634393738323434353030373432,s{29568,29568,1548129606797,1548129606797,0,0,0,0,18,0,29568}
2019-1-22 12:00:07[DEBUG](ClientCnxn.java:846) Reading reply sessionid:0x1000001a10c0016, packet:: clientPath:/example/customize-queue/0000000312 serverPath:/example/customize-queue/0000000312 finished:false header:: 29,4 replyHeader:: 29,29572,0 request:: '/example/customize-queue/0000000312,T response:: #373938303239383435303932303038363435,s{29567,29567,1548129606797,1548129606797,0,0,0,0,18,0,29567}
2019-1-22 12:00:07[DEBUG](ClientCnxn.java:846) Reading reply sessionid:0x1000001a10c0016, packet:: clientPath:/example/customize-queue/0000000315 serverPath:/example/customize-queue/0000000315 finished:false header:: 30,4 replyHeader:: 30,29572,0 request:: '/example/customize-queue/0000000315,T response:: #333632323832363439373537323233313334,s{29570,29570,1548129606798,1548129606798,0,0,0,0,18,0,29570}
2019-1-22 12:00:07[DEBUG](ClientCnxn.java:846) Reading reply sessionid:0x1000001a10c0016, packet:: clientPath:/example/customize-queue/0000000314 serverPath:/example/customize-queue/0000000314 finished:false header:: 31,4 replyHeader:: 31,29572,0 request:: '/example/customize-queue/0000000314,T response:: #363331373330353537373830363636343434,s{29569,29569,1548129606798,1548129606798,0,0,0,0,18,0,29569}
2019-1-22 12:00:07[DEBUG](ClientCnxn.java:846) Reading reply sessionid:0x1000001a10c0016, packet:: clientPath:/example/customize-queue/0000000317 serverPath:/example/customize-queue/0000000317 finished:false header:: 32,4 replyHeader:: 32,29572,0 request:: '/example/customize-queue/0000000317,T response:: #383636363735303037383438373537343434,s{29572,29572,1548129606798,1548129606798,0,0,0,0,18,0,29572}
2019-1-22 12:00:07[DEBUG](ClientCnxn.java:846) Reading reply sessionid:0x1000001a10c0016, packet:: clientPath:/example/customize-queue/0000000316 serverPath:/example/customize-queue/0000000316 finished:false header:: 33,4 replyHeader:: 33,29572,0 request:: '/example/customize-queue/0000000316,T response:: #333136373835373839353034343736383637,s{29571,29571,1548129606798,1548129606798,0,0,0,0,18,0,29571}
2019-1-22 12:00:07[DEBUG](ClientCnxn.java:846) Reading reply sessionid:0x1000001a10c0016, packet:: clientPath:/example/customize-queue/0000000308 serverPath:/example/customize-queue/0000000308 finished:false header:: 34,4 replyHeader:: 34,29572,0 request:: '/example/customize-queue/0000000308,T response:: #303533373635353731333830343635393236,s{29563,29563,1548129606797,1548129606797,0,0,0,0,18,0,29563}
2019-1-22 12:00:07[DEBUG](ClientCnxn.java:846) Reading reply sessionid:0x1000001a10c0016, packet:: clientPath:/example/customize-queue/0000000309 serverPath:/example/customize-queue/0000000309 finished:false header:: 35,4 replyHeader:: 35,29572,0 request:: '/example/customize-queue/0000000309,T response:: #393333313534323939333837393036303734,s{29564,29564,1548129606797,1548129606797,0,0,0,0,18,0,29564}
2019-1-22 12:00:07[DEBUG](ClientCnxn.java:846) Reading reply sessionid:0x1000001a10c0016, packet:: clientPath:null serverPath:null finished:false header:: 36,12 replyHeader:: 36,29572,0 request:: '/example/customize-queue,F response:: v{'0000000311,'0000000310,'0000000313,'0000000312,'0000000315,'0000000314,'0000000317,'0000000316,'0000000308,'0000000309},s{27043,27043,1547994570434,1547994570434,0,626,0,0,3,10,29572}
2019-1-22 12:00:07[DEBUG](ClientCnxn.java:846) Reading reply sessionid:0x1000001a10c0016, packet:: clientPath:null serverPath:null finished:false header:: 37,4 replyHeader:: 37,29572,0 request:: '/example/customize-queue/0000000308,F response:: #303533373635353731333830343635393236,s{29563,29563,1548129606797,1548129606797,0,0,0,0,18,0,29563}
2019-1-22 12:00:07[DEBUG](CustomizeQueue.java:45) 新增节点,接收到创建订单请求,开始处理订单: 053765571380465926
2019-1-22 12:00:07[DEBUG](ClientCnxn.java:769) Got notification sessionid:0x1000001a10c0016
2019-1-22 12:00:07[DEBUG](ClientCnxn.java:791) Got WatchedEvent state:SyncConnected type:NodeDeleted path:/example/customize-queue/0000000308 for sessionid 0x1000001a10c0016
2019-1-22 12:00:07[DEBUG](ClientCnxn.java:769) Got notification sessionid:0x1000001a10c0016
2019-1-22 12:00:07[DEBUG](ClientCnxn.java:791) Got WatchedEvent state:SyncConnected type:NodeChildrenChanged path:/example/customize-queue for sessionid 0x1000001a10c0016
2019-1-22 12:00:07[DEBUG](ClientCnxn.java:846) Reading reply sessionid:0x1000001a10c0016, packet:: clientPath:null serverPath:null finished:false header:: 38,2 replyHeader:: 38,29573,0 request:: '/example/customize-queue/0000000308,-1 response:: null
2019-1-22 12:00:07[DEBUG](ClientCnxn.java:846) Reading reply sessionid:0x1000001a10c0016, packet:: clientPath:null serverPath:null finished:false header:: 39,4 replyHeader:: 39,29573,0 request:: '/example/customize-queue/0000000309,F response:: #393333313534323939333837393036303734,s{29564,29564,1548129606797,1548129606797,0,0,0,0,18,0,29564}
2019-1-22 12:00:07[DEBUG](CustomizeQueue.java:45) 新增节点,接收到创建订单请求,开始处理订单: 933154299387906074
2019-1-22 12:00:07[DEBUG](ClientCnxn.java:769) Got notification sessionid:0x1000001a10c0016
2019-1-22 12:00:07[DEBUG](ClientCnxn.java:791) Got WatchedEvent state:SyncConnected type:NodeDeleted path:/example/customize-queue/0000000309 for sessionid 0x1000001a10c0016
2019-1-22 12:00:07[DEBUG](ClientCnxn.java:846) Reading reply sessionid:0x1000001a10c0016, packet:: clientPath:null serverPath:null finished:false header:: 40,2 replyHeader:: 40,29574,0 request:: '/example/customize-queue/0000000309,-1 response:: null
2019-1-22 12:00:07[DEBUG](ClientCnxn.java:846) Reading reply sessionid:0x1000001a10c0016, packet:: clientPath:null serverPath:null finished:false header:: 41,4 replyHeader:: 41,29574,0 request:: '/example/customize-queue/0000000310,F response:: #373137343836393039363030373639333834,s{29565,29565,1548129606797,1548129606797,0,0,0,0,18,0,29565}
2019-1-22 12:00:07[DEBUG](CustomizeQueue.java:45) 新增节点,接收到创建订单请求,开始处理订单: 717486909600769384
2019-1-22 12:00:07[DEBUG](ClientCnxn.java:769) Got notification sessionid:0x1000001a10c0016
2019-1-22 12:00:07[DEBUG](ClientCnxn.java:791) Got WatchedEvent state:SyncConnected type:NodeDeleted path:/example/customize-queue/0000000310 for sessionid 0x1000001a10c0016
2019-1-22 12:00:07[DEBUG](ClientCnxn.java:846) Reading reply sessionid:0x1000001a10c0016, packet:: clientPath:null serverPath:null finished:false header:: 42,2 replyHeader:: 42,29575,0 request:: '/example/customize-queue/0000000310,-1 response:: null
2019-1-22 12:00:07[DEBUG](ClientCnxn.java:846) Reading reply sessionid:0x1000001a10c0016, packet:: clientPath:null serverPath:null finished:false header:: 43,4 replyHeader:: 43,29575,0 request:: '/example/customize-queue/0000000311,F response:: #313036303631373233323538303632333038,s{29566,29566,1548129606797,1548129606797,0,0,0,0,18,0,29566}
2019-1-22 12:00:07[DEBUG](CustomizeQueue.java:45) 新增节点,接收到创建订单请求,开始处理订单: 106061723258062308
2019-1-22 12:00:07[DEBUG](ClientCnxn.java:769) Got notification sessionid:0x1000001a10c0016
2019-1-22 12:00:07[DEBUG](ClientCnxn.java:791) Got WatchedEvent state:SyncConnected type:NodeDeleted path:/example/customize-queue/0000000311 for sessionid 0x1000001a10c0016
2019-1-22 12:00:07[DEBUG](ClientCnxn.java:846) Reading reply sessionid:0x1000001a10c0016, packet:: clientPath:null serverPath:null finished:false header:: 44,2 replyHeader:: 44,29576,0 request:: '/example/customize-queue/0000000311,-1 response:: null
2019-1-22 12:00:07[DEBUG](ClientCnxn.java:846) Reading reply sessionid:0x1000001a10c0016, packet:: clientPath:null serverPath:null finished:false header:: 45,4 replyHeader:: 45,29576,0 request:: '/example/customize-queue/0000000312,F response:: #373938303239383435303932303038363435,s{29567,29567,1548129606797,1548129606797,0,0,0,0,18,0,29567}
2019-1-22 12:00:07[DEBUG](CustomizeQueue.java:45) 新增节点,接收到创建订单请求,开始处理订单: 798029845092008645
2019-1-22 12:00:07[DEBUG](ClientCnxn.java:769) Got notification sessionid:0x1000001a10c0016
2019-1-22 12:00:07[DEBUG](ClientCnxn.java:791) Got WatchedEvent state:SyncConnected type:NodeDeleted path:/example/customize-queue/0000000312 for sessionid 0x1000001a10c0016
2019-1-22 12:00:07[DEBUG](ClientCnxn.java:846) Reading reply sessionid:0x1000001a10c0016, packet:: clientPath:null serverPath:null finished:false header:: 46,2 replyHeader:: 46,29577,0 request:: '/example/customize-queue/0000000312,-1 response:: null
2019-1-22 12:00:07[DEBUG](ClientCnxn.java:846) Reading reply sessionid:0x1000001a10c0016, packet:: clientPath:null serverPath:null finished:false header:: 47,4 replyHeader:: 47,29577,0 request:: '/example/customize-queue/0000000313,F response:: #303330313634393738323434353030373432,s{29568,29568,1548129606797,1548129606797,0,0,0,0,18,0,29568}
2019-1-22 12:00:07[DEBUG](CustomizeQueue.java:45) 新增节点,接收到创建订单请求,开始处理订单: 030164978244500742
2019-1-22 12:00:07[DEBUG](ClientCnxn.java:769) Got notification sessionid:0x1000001a10c0016
2019-1-22 12:00:07[DEBUG](ClientCnxn.java:791) Got WatchedEvent state:SyncConnected type:NodeDeleted path:/example/customize-queue/0000000313 for sessionid 0x1000001a10c0016
2019-1-22 12:00:07[DEBUG](ClientCnxn.java:846) Reading reply sessionid:0x1000001a10c0016, packet:: clientPath:null serverPath:null finished:false header:: 48,2 replyHeader:: 48,29578,0 request:: '/example/customize-queue/0000000313,-1 response:: null
2019-1-22 12:00:07[DEBUG](ClientCnxn.java:846) Reading reply sessionid:0x1000001a10c0016, packet:: clientPath:null serverPath:null finished:false header:: 49,4 replyHeader:: 49,29578,0 request:: '/example/customize-queue/0000000314,F response:: #363331373330353537373830363636343434,s{29569,29569,1548129606798,1548129606798,0,0,0,0,18,0,29569}
2019-1-22 12:00:07[DEBUG](CustomizeQueue.java:45) 新增节点,接收到创建订单请求,开始处理订单: 631730557780666444
2019-1-22 12:00:07[DEBUG](ClientCnxn.java:769) Got notification sessionid:0x1000001a10c0016
2019-1-22 12:00:07[DEBUG](ClientCnxn.java:791) Got WatchedEvent state:SyncConnected type:NodeDeleted path:/example/customize-queue/0000000314 for sessionid 0x1000001a10c0016
2019-1-22 12:00:07[DEBUG](ClientCnxn.java:846) Reading reply sessionid:0x1000001a10c0016, packet:: clientPath:null serverPath:null finished:false header:: 50,2 replyHeader:: 50,29579,0 request:: '/example/customize-queue/0000000314,-1 response:: null
2019-1-22 12:00:07[DEBUG](ClientCnxn.java:846) Reading reply sessionid:0x1000001a10c0016, packet:: clientPath:null serverPath:null finished:false header:: 51,4 replyHeader:: 51,29579,0 request:: '/example/customize-queue/0000000315,F response:: #333632323832363439373537323233313334,s{29570,29570,1548129606798,1548129606798,0,0,0,0,18,0,29570}
2019-1-22 12:00:07[DEBUG](CustomizeQueue.java:45) 新增节点,接收到创建订单请求,开始处理订单: 362282649757223134
2019-1-22 12:00:07[DEBUG](ClientCnxn.java:769) Got notification sessionid:0x1000001a10c0016
2019-1-22 12:00:07[DEBUG](ClientCnxn.java:791) Got WatchedEvent state:SyncConnected type:NodeDeleted path:/example/customize-queue/0000000315 for sessionid 0x1000001a10c0016
2019-1-22 12:00:07[DEBUG](ClientCnxn.java:846) Reading reply sessionid:0x1000001a10c0016, packet:: clientPath:null serverPath:null finished:false header:: 52,2 replyHeader:: 52,29580,0 request:: '/example/customize-queue/0000000315,-1 response:: null
2019-1-22 12:00:07[DEBUG](ClientCnxn.java:846) Reading reply sessionid:0x1000001a10c0016, packet:: clientPath:null serverPath:null finished:false header:: 53,4 replyHeader:: 53,29580,0 request:: '/example/customize-queue/0000000316,F response:: #333136373835373839353034343736383637,s{29571,29571,1548129606798,1548129606798,0,0,0,0,18,0,29571}
2019-1-22 12:00:07[DEBUG](CustomizeQueue.java:45) 新增节点,接收到创建订单请求,开始处理订单: 316785789504476867
2019-1-22 12:00:07[DEBUG](ClientCnxn.java:769) Got notification sessionid:0x1000001a10c0016
2019-1-22 12:00:07[DEBUG](ClientCnxn.java:791) Got WatchedEvent state:SyncConnected type:NodeDeleted path:/example/customize-queue/0000000316 for sessionid 0x1000001a10c0016
2019-1-22 12:00:07[DEBUG](ClientCnxn.java:846) Reading reply sessionid:0x1000001a10c0016, packet:: clientPath:null serverPath:null finished:false header:: 54,2 replyHeader:: 54,29581,0 request:: '/example/customize-queue/0000000316,-1 response:: null
2019-1-22 12:00:07[DEBUG](ClientCnxn.java:846) Reading reply sessionid:0x1000001a10c0016, packet:: clientPath:null serverPath:null finished:false header:: 55,4 replyHeader:: 55,29581,0 request:: '/example/customize-queue/0000000317,F response:: #383636363735303037383438373537343434,s{29572,29572,1548129606798,1548129606798,0,0,0,0,18,0,29572}
2019-1-22 12:00:07[DEBUG](CustomizeQueue.java:45) 新增节点,接收到创建订单请求,开始处理订单: 866675007848757444
2019-1-22 12:00:07[DEBUG](ClientCnxn.java:769) Got notification sessionid:0x1000001a10c0016
2019-1-22 12:00:07[DEBUG](ClientCnxn.java:791) Got WatchedEvent state:SyncConnected type:NodeDeleted path:/example/customize-queue/0000000317 for sessionid 0x1000001a10c0016
2019-1-22 12:00:07[DEBUG](ClientCnxn.java:846) Reading reply sessionid:0x1000001a10c0016, packet:: clientPath:null serverPath:null finished:false header:: 56,2 replyHeader:: 56,29582,0 request:: '/example/customize-queue/0000000317,-1 response:: null
2019-1-22 12:00:07[DEBUG](ClientCnxn.java:846) Reading reply sessionid:0x1000001a10c0016, packet:: clientPath:null serverPath:null finished:false header:: 57,12 replyHeader:: 57,29582,0 request:: '/example/customize-queue,F response:: v{},s{27043,27043,1547994570434,1547994570434,0,636,0,0,3,0,29582}
2019-1-22 12:00:07[DEBUG](ClientCnxn.java:846) Reading reply sessionid:0x1000001a10c0016, packet:: clientPath:null serverPath:null finished:false header:: 58,12 replyHeader:: 58,29582,0 request:: '/example/customize-queue,F response:: v{},s{27043,27043,1547994570434,1547994570434,0,636,0,0,3,0,29582}
2019-1-22 12:00:07[DEBUG](ClientCnxn.java:846) Reading reply sessionid:0x1000001a10c0016, packet:: clientPath:null serverPath:null finished:false header:: 59,12 replyHeader:: 59,29582,0 request:: '/example/customize-queue,F response:: v{},s{27043,27043,1547994570434,1547994570434,0,636,0,0,3,0,29582}
2019-1-22 12:00:07[DEBUG](ClientCnxn.java:846) Reading reply sessionid:0x1000001a10c0016, packet:: clientPath:null serverPath:null finished:false header:: 60,12 replyHeader:: 60,29582,0 request:: '/example/customize-queue,F response:: v{},s{27043,27043,1547994570434,1547994570434,0,636,0,0,3,0,29582}
2019-1-22 12:00:07[DEBUG](ClientCnxn.java:846) Reading reply sessionid:0x1000001a10c0016, packet:: clientPath:null serverPath:null finished:false header:: 61,12 replyHeader:: 61,29582,0 request:: '/example/customize-queue,F response:: v{},s{27043,27043,1547994570434,1547994570434,0,636,0,0,3,0,29582}
2019-1-22 12:00:07[DEBUG](ClientCnxn.java:846) Reading reply sessionid:0x1000001a10c0016, packet:: clientPath:null serverPath:null finished:false header:: 62,12 replyHeader:: 62,29582,0 request:: '/example/customize-queue,F response:: v{},s{27043,27043,1547994570434,1547994570434,0,636,0,0,3,0,29582}
2019-1-22 12:00:07[DEBUG](ClientCnxn.java:846) Reading reply sessionid:0x1000001a10c0016, packet:: clientPath:null serverPath:null finished:false header:: 63,12 replyHeader:: 63,29582,0 request:: '/example/customize-queue,F response:: v{},s{27043,27043,1547994570434,1547994570434,0,636,0,0,3,0,29582}
2019-1-22 12:00:07[DEBUG](ClientCnxn.java:846) Reading reply sessionid:0x1000001a10c0016, packet:: clientPath:null serverPath:null finished:false header:: 64,12 replyHeader:: 64,29582,0 request:: '/example/customize-queue,F response:: v{},s{27043,27043,1547994570434,1547994570434,0,636,0,0,3,0,29582}
2019-1-22 12:00:07[DEBUG](ClientCnxn.java:846) Reading reply sessionid:0x1000001a10c0016, packet:: clientPath:null serverPath:null finished:false header:: 65,12 replyHeader:: 65,29582,0 request:: '/example/customize-queue,F response:: v{},s{27043,27043,1547994570434,1547994570434,0,636,0,0,3,0,29582}
2019-1-22 12:00:07[DEBUG](CustomizeQueue.java:55) 处理订单成功,移除订单,当前订单号为:053765571380465926, 节点为:/example/customize-queue/0000000308
2019-1-22 12:00:07[DEBUG](CustomizeQueue.java:55) 处理订单成功,移除订单,当前订单号为:933154299387906074, 节点为:/example/customize-queue/0000000309
2019-1-22 12:00:07[DEBUG](CustomizeQueue.java:55) 处理订单成功,移除订单,当前订单号为:717486909600769384, 节点为:/example/customize-queue/0000000310
2019-1-22 12:00:07[DEBUG](CustomizeQueue.java:55) 处理订单成功,移除订单,当前订单号为:106061723258062308, 节点为:/example/customize-queue/0000000311
2019-1-22 12:00:07[DEBUG](CustomizeQueue.java:55) 处理订单成功,移除订单,当前订单号为:798029845092008645, 节点为:/example/customize-queue/0000000312
2019-1-22 12:00:07[DEBUG](CustomizeQueue.java:55) 处理订单成功,移除订单,当前订单号为:030164978244500742, 节点为:/example/customize-queue/0000000313
2019-1-22 12:00:07[DEBUG](CustomizeQueue.java:55) 处理订单成功,移除订单,当前订单号为:631730557780666444, 节点为:/example/customize-queue/0000000314
2019-1-22 12:00:07[DEBUG](CustomizeQueue.java:55) 处理订单成功,移除订单,当前订单号为:362282649757223134, 节点为:/example/customize-queue/0000000315
2019-1-22 12:00:07[DEBUG](CustomizeQueue.java:55) 处理订单成功,移除订单,当前订单号为:316785789504476867, 节点为:/example/customize-queue/0000000316
2019-1-22 12:00:07[DEBUG](CustomizeQueue.java:55) 处理订单成功,移除订单,当前订单号为:866675007848757444, 节点为:/example/customize-queue/0000000317
2019-1-22 12:00:07[DEBUG](ClientCnxn.java:846) Reading reply sessionid:0x1000001a10c0016, packet:: clientPath:/example/customize-queue serverPath:/example/customize-queue finished:false header:: 66,12 replyHeader:: 66,29582,0 request:: '/example/customize-queue,T response:: v{},s{27043,27043,1547994570434,1547994570434,0,636,0,0,3,0,29582}
2019-1-22 12:00:09[DEBUG](ClientCnxn.java:745) Got ping response for sessionid: 0x1000001a10c0016 after 1ms
2019-1-22 12:00:11[DEBUG](ClientCnxn.java:745) Got ping response for sessionid: 0x1000001a10c0016 after 1ms
2019-1-22 12:00:12[DEBUG](ClientCnxn.java:745) Got ping response for sessionid: 0x1000001a10c0016 after 2ms
2019-1-22 12:00:14[DEBUG](ClientCnxn.java:745) Got ping response for sessionid: 0x1000001a10c0016 after 1ms
public class DistributedQueueExample {
private static final String PATH = "/example/customize-queue";
private static final String CONNECT_IP_PORT = "176.16.0.135:2181";
private static final Logger logger = LoggerFactory.getLogger(DistributedQueueExample.class);
public static void main(String[] args) throws Exception {
CuratorFramework client = null;
DistributedQueue<String> queue = null;
try {
client = CuratorFrameworkFactory.builder().connectString(CONNECT_IP_PORT).sessionTimeoutMs(5000)
.connectionTimeoutMs(5000).retryPolicy(new ExponentialBackoffRetry(1000, 3)).build();
client.start();
logger.debug("创建连接成功:{}", client);
// 消费者
QueueConsumer<String> consumer = createQueueConsumer();
// 生产者
queue = QueueBuilder.builder(client, consumer, createQueueSerializer(), PATH).buildQueue();
queue.start();
for (int i = 0; i < 10; i++) {
queue.put(" test-" + i);
}
TimeUnit.SECONDS.sleep(20);
} catch (Exception ex) {
} finally {
CloseableUtils.closeQuietly(queue);
CloseableUtils.closeQuietly(client);
}
}
private static QueueSerializer<String> createQueueSerializer() {
return new QueueSerializer<String>() {
@Override
public byte[] serialize(String item) {
return item.getBytes();
}
@Override
public String deserialize(byte[] bytes) {
return new String(bytes);
}
};
}
private static QueueConsumer<String> createQueueConsumer() {
return new QueueConsumer<String>() {
@Override
public void stateChanged(CuratorFramework client, ConnectionState newState) {
logger.debug("状态改变,当前状态:{}", newState.name());
}
@Override
public void consumeMessage(String message) throws Exception {
logger.debug("消费者消费消息:{}", message);
}
};
}
}
测试结果
2019-1-22 12:02:45[ INFO](Compatibility.java:41) Running in ZooKeeper 3.4.x compatibility mode
2019-1-22 12:02:45[ INFO](CuratorFrameworkImpl.java:308) Starting
2019-1-22 12:02:45[DEBUG](CuratorZookeeperClient.java:230) Starting
2019-1-22 12:02:45[DEBUG](ConnectionState.java:109) Starting
2019-1-22 12:02:45[DEBUG](ConnectionState.java:197) reset
2019-1-22 12:02:49[ INFO](Environment.java:100) Client environment:zookeeper.version=3.4.13-2d71af4dbe22557fda74f9a9b4309b15a7487f03, built on 06/29/2018 00:39 GMT
2019-1-22 12:02:49[ INFO](Environment.java:100) Client environment:host.name=momo
2019-1-22 12:02:49[ INFO](Environment.java:100) Client environment:java.version=1.8.0_131
2019-1-22 12:02:49[ INFO](Environment.java:100) Client environment:java.vendor=Oracle Corporation
2019-1-22 12:02:49[ INFO](Environment.java:100) Client environment:java.home=C:\Program Files\Java\jre1.8.0_131
2019-1-22 12:02:49[ INFO](Environment.java:100) Client environment:java.class.path=C:\TempData\my-workspace\zookeeperuse\target\classes;C:\TempData\maven-workspace\org\apache\zookeeper\zookeeper\3.4.13\zookeeper-3.4.13.jar;C:\TempData\maven-workspace\org\slf4j\slf4j-api\1.7.25\slf4j-api-1.7.25.jar;C:\TempData\maven-workspace\org\slf4j\slf4j-log4j12\1.7.25\slf4j-log4j12-1.7.25.jar;C:\TempData\maven-workspace\log4j\log4j\1.2.17\log4j-1.2.17.jar;C:\TempData\maven-workspace\jline\jline\0.9.94\jline-0.9.94.jar;C:\TempData\maven-workspace\org\apache\yetus\audience-annotations\0.5.0\audience-annotations-0.5.0.jar;C:\TempData\maven-workspace\io\netty\netty\3.10.6.Final\netty-3.10.6.Final.jar;C:\TempData\maven-workspace\com\101tec\zkclient\0.11\zkclient-0.11.jar;C:\TempData\maven-workspace\org\apache\curator\curator-framework\4.1.0\curator-framework-4.1.0.jar;C:\TempData\maven-workspace\org\apache\curator\curator-client\4.1.0\curator-client-4.1.0.jar;C:\TempData\maven-workspace\com\google\guava\guava\20.0\guava-20.0.jar;C:\TempData\maven-workspace\org\apache\curator\curator-recipes\4.1.0\curator-recipes-4.1.0.jar
2019-1-22 12:02:49[ INFO](Environment.java:100) Client environment:java.library.path=C:\Program Files\Java\jre1.8.0_131\bin;C:\WINDOWS\Sun\Java\bin;C:\WINDOWS\system32;C:\WINDOWS;C:/Program Files/Java/jre1.8.0_131/bin/server;C:/Program Files/Java/jre1.8.0_131/bin;C:/Program Files/Java/jre1.8.0_131/lib/amd64;C:\ProgramData\Oracle\Java\javapath;C:\Program Files (x86)\Intel\iCLS Client\;C:\Program Files\Intel\iCLS Client\;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\WINDOWS\System32\WindowsPowerShell\v1.0\;C:\Program Files (x86)\Intel\Intel(R) Management Engine Components\DAL;C:\Program Files\Intel\Intel(R) Management Engine Components\DAL;C:\Program Files (x86)\Intel\Intel(R) Management Engine Components\IPT;C:\Program Files\Intel\Intel(R) Management Engine Components\IPT;C:\Program Files\TortoiseSVN\bin;C:\tools\apache-maven-3.5.4\bin;C:\Program Files\Java\jdk1.8.0_131\bin;C:\Program Files\Java\jdk1.8.0_131\lib;C:\Program Files\Java\jdk1.8.0_131\lib\tools.jar;C:\tools\apache-maven-3.5.4\bin\;C:\Program Files\MySQL\MySQL Server 5.5\bin;C:\Program Files\Git\cmd;C:\Program Files\Java\jre1.8.0_131\lib;C:\Program Files\Java\jre1.8.0_131\bin;C:\tools\apache-tomcat-6.0.48\bin;;C:\Program Files (x86)\OpenGrADS\Contents\Cygwin\Versions2.0.a9.oga.1\i686;C:\Users\it\AppData\Local\Microsoft\WindowsApps;C:\tools\eclipse-64;;.
2019-1-22 12:02:49[ INFO](Environment.java:100) Client environment:java.io.tmpdir=C:\Users\it\AppData\Local\Temp\
2019-1-22 12:02:49[ INFO](Environment.java:100) Client environment:java.compiler=<NA>
2019-1-22 12:02:49[ INFO](Environment.java:100) Client environment:os.name=Windows 10
2019-1-22 12:02:49[ INFO](Environment.java:100) Client environment:os.arch=amd64
2019-1-22 12:02:49[ INFO](Environment.java:100) Client environment:os.version=10.0
2019-1-22 12:02:49[ INFO](Environment.java:100) Client environment:user.name=it
2019-1-22 12:02:49[ INFO](Environment.java:100) Client environment:user.home=C:\Users\it
2019-1-22 12:02:49[ INFO](Environment.java:100) Client environment:user.dir=C:\TempData\my-workspace\zookeeperuse
2019-1-22 12:02:49[ INFO](ZooKeeper.java:442) Initiating client connection, connectString=176.16.0.135:2181 sessionTimeout=5000 watcher=org.apache.curator.ConnectionState@2f7a2457
2019-1-22 12:02:49[DEBUG](ClientCnxn.java:120) zookeeper.disableAutoWatchReset is false
2019-1-22 12:02:50[ INFO](CuratorFrameworkImpl.java:350) Default schema
2019-1-22 12:02:50[DEBUG](DistributedQueueExample.java:29) 创建连接成功:org.apache.curator.framework.imps.CuratorFrameworkImpl@42d80b78
2019-1-22 12:02:54[ INFO](ClientCnxn.java:1029) Opening socket connection to server 176.16.0.135/176.16.0.135:2181. Will not attempt to authenticate using SASL (unknown error)
2019-1-22 12:02:54[ INFO](ClientCnxn.java:879) Socket connection established to 176.16.0.135/176.16.0.135:2181, initiating session
2019-1-22 12:02:54[DEBUG](ClientCnxn.java:952) Session establishment request sent on 176.16.0.135/176.16.0.135:2181
2019-1-22 12:02:54[ INFO](ClientCnxn.java:1303) Session establishment complete on server 176.16.0.135/176.16.0.135:2181, sessionid = 0x1000001a10c0017, negotiated timeout = 5000
2019-1-22 12:02:54[DEBUG](ConnectionState.java:177) Negotiated session timeout: 5000
2019-1-22 12:02:54[ INFO](ConnectionStateManager.java:237) State change: CONNECTED
2019-1-22 12:02:54[DEBUG](CuratorFrameworkImpl.java:1016) Clearing sleep for 0 operations
2019-1-22 12:02:54[DEBUG](ClientCnxn.java:846) Reading reply sessionid:0x1000001a10c0017, packet:: clientPath:null serverPath:null finished:false header:: 1,1 replyHeader:: 1,29585,-110 request:: '/example/customize-queue,#3139322e3136382e35362e31,v{s{31,s{'world,'anyone}}},0 response::
2019-1-22 12:02:54[DEBUG](ClientCnxn.java:846) Reading reply sessionid:0x1000001a10c0017, packet:: clientPath:/example/customize-queue serverPath:/example/customize-queue finished:false header:: 2,12 replyHeader:: 2,29585,0 request:: '/example/customize-queue,T response:: v{},s{27043,27043,1547994570434,1547994570434,0,636,0,0,3,0,29582}
2019-1-22 12:02:54[DEBUG](ClientCnxn.java:769) Got notification sessionid:0x1000001a10c0017
2019-1-22 12:02:54[DEBUG](ClientCnxn.java:791) Got WatchedEvent state:SyncConnected type:NodeChildrenChanged path:/example/customize-queue for sessionid 0x1000001a10c0017
2019-1-22 12:02:54[DEBUG](ClientCnxn.java:846) Reading reply sessionid:0x1000001a10c0017, packet:: clientPath:/example/customize-queue/queue- serverPath:/example/customize-queue/queue- finished:false header:: 3,1 replyHeader:: 3,29586,0 request:: '/example/customize-queue/queue-,#01011000720746573742d302,v{s{31,s{'world,'anyone}}},2 response:: '/example/customize-queue/queue-0000000318
2019-1-22 12:02:54[DEBUG](ClientCnxn.java:846) Reading reply sessionid:0x1000001a10c0017, packet:: clientPath:/example/customize-queue/queue- serverPath:/example/customize-queue/queue- finished:false header:: 4,1 replyHeader:: 4,29587,0 request:: '/example/customize-queue/queue-,#01011000720746573742d312,v{s{31,s{'world,'anyone}}},2 response:: '/example/customize-queue/queue-0000000319
2019-1-22 12:02:54[DEBUG](ClientCnxn.java:846) Reading reply sessionid:0x1000001a10c0017, packet:: clientPath:/example/customize-queue/queue- serverPath:/example/customize-queue/queue- finished:false header:: 5,1 replyHeader:: 5,29588,0 request:: '/example/customize-queue/queue-,#01011000720746573742d322,v{s{31,s{'world,'anyone}}},2 response:: '/example/customize-queue/queue-0000000320
2019-1-22 12:02:54[DEBUG](ClientCnxn.java:846) Reading reply sessionid:0x1000001a10c0017, packet:: clientPath:/example/customize-queue/queue- serverPath:/example/customize-queue/queue- finished:false header:: 6,1 replyHeader:: 6,29589,0 request:: '/example/customize-queue/queue-,#01011000720746573742d332,v{s{31,s{'world,'anyone}}},2 response:: '/example/customize-queue/queue-0000000321
2019-1-22 12:02:54[DEBUG](ClientCnxn.java:846) Reading reply sessionid:0x1000001a10c0017, packet:: clientPath:/example/customize-queue/queue- serverPath:/example/customize-queue/queue- finished:false header:: 7,1 replyHeader:: 7,29590,0 request:: '/example/customize-queue/queue-,#01011000720746573742d342,v{s{31,s{'world,'anyone}}},2 response:: '/example/customize-queue/queue-0000000322
2019-1-22 12:02:54[DEBUG](ClientCnxn.java:846) Reading reply sessionid:0x1000001a10c0017, packet:: clientPath:/example/customize-queue/queue- serverPath:/example/customize-queue/queue- finished:false header:: 8,1 replyHeader:: 8,29591,0 request:: '/example/customize-queue/queue-,#01011000720746573742d352,v{s{31,s{'world,'anyone}}},2 response:: '/example/customize-queue/queue-0000000323
2019-1-22 12:02:54[DEBUG](ClientCnxn.java:846) Reading reply sessionid:0x1000001a10c0017, packet:: clientPath:/example/customize-queue/queue- serverPath:/example/customize-queue/queue- finished:false header:: 9,1 replyHeader:: 9,29592,0 request:: '/example/customize-queue/queue-,#01011000720746573742d362,v{s{31,s{'world,'anyone}}},2 response:: '/example/customize-queue/queue-0000000324
2019-1-22 12:02:54[DEBUG](ClientCnxn.java:846) Reading reply sessionid:0x1000001a10c0017, packet:: clientPath:/example/customize-queue/queue- serverPath:/example/customize-queue/queue- finished:false header:: 10,1 replyHeader:: 10,29593,0 request:: '/example/customize-queue/queue-,#01011000720746573742d372,v{s{31,s{'world,'anyone}}},2 response:: '/example/customize-queue/queue-0000000325
2019-1-22 12:02:54[DEBUG](ClientCnxn.java:846) Reading reply sessionid:0x1000001a10c0017, packet:: clientPath:/example/customize-queue/queue- serverPath:/example/customize-queue/queue- finished:false header:: 11,1 replyHeader:: 11,29594,0 request:: '/example/customize-queue/queue-,#01011000720746573742d382,v{s{31,s{'world,'anyone}}},2 response:: '/example/customize-queue/queue-0000000326
2019-1-22 12:02:54[DEBUG](ClientCnxn.java:846) Reading reply sessionid:0x1000001a10c0017, packet:: clientPath:/example/customize-queue/queue- serverPath:/example/customize-queue/queue- finished:false header:: 12,1 replyHeader:: 12,29595,0 request:: '/example/customize-queue/queue-,#01011000720746573742d392,v{s{31,s{'world,'anyone}}},2 response:: '/example/customize-queue/queue-0000000327
2019-1-22 12:02:54[DEBUG](ClientCnxn.java:846) Reading reply sessionid:0x1000001a10c0017, packet:: clientPath:/example/customize-queue serverPath:/example/customize-queue finished:false header:: 13,12 replyHeader:: 13,29595,0 request:: '/example/customize-queue,T response:: v{'queue-0000000327,'queue-0000000326,'queue-0000000325,'queue-0000000324,'queue-0000000323,'queue-0000000322,'queue-0000000321,'queue-0000000320,'queue-0000000319,'queue-0000000318},s{27043,27043,1547994570434,1547994570434,0,646,0,0,3,10,29595}
2019-1-22 12:02:55[DEBUG](ClientCnxn.java:846) Reading reply sessionid:0x1000001a10c0017, packet:: clientPath:null serverPath:null finished:false header:: 14,4 replyHeader:: 14,29595,0 request:: '/example/customize-queue/queue-0000000318,F response:: #01011000720746573742d302,s{29586,29586,1548129774242,1548129774242,0,0,0,0,17,0,29586}
2019-1-22 12:02:55[DEBUG](ClientCnxn.java:769) Got notification sessionid:0x1000001a10c0017
2019-1-22 12:02:55[DEBUG](ClientCnxn.java:791) Got WatchedEvent state:SyncConnected type:NodeChildrenChanged path:/example/customize-queue for sessionid 0x1000001a10c0017
2019-1-22 12:02:55[DEBUG](ClientCnxn.java:846) Reading reply sessionid:0x1000001a10c0017, packet:: clientPath:null serverPath:null finished:false header:: 15,2 replyHeader:: 15,29596,0 request:: '/example/customize-queue/queue-0000000318,0 response:: null
2019-1-22 12:02:55[DEBUG](DistributedQueueExample.java:74) 消费者消费消息: test-0
2019-1-22 12:02:55[DEBUG](ClientCnxn.java:846) Reading reply sessionid:0x1000001a10c0017, packet:: clientPath:/example/customize-queue serverPath:/example/customize-queue finished:false header:: 16,12 replyHeader:: 16,29596,0 request:: '/example/customize-queue,T response:: v{'queue-0000000327,'queue-0000000326,'queue-0000000325,'queue-0000000324,'queue-0000000323,'queue-0000000322,'queue-0000000321,'queue-0000000320,'queue-0000000319},s{27043,27043,1547994570434,1547994570434,0,647,0,0,3,9,29596}
2019-1-22 12:02:55[DEBUG](ClientCnxn.java:846) Reading reply sessionid:0x1000001a10c0017, packet:: clientPath:null serverPath:null finished:false header:: 17,4 replyHeader:: 17,29596,0 request:: '/example/customize-queue/queue-0000000319,F response:: #01011000720746573742d312,s{29587,29587,1548129774246,1548129774246,0,0,0,0,17,0,29587}
2019-1-22 12:02:55[DEBUG](ClientCnxn.java:769) Got notification sessionid:0x1000001a10c0017
2019-1-22 12:02:55[DEBUG](ClientCnxn.java:791) Got WatchedEvent state:SyncConnected type:NodeChildrenChanged path:/example/customize-queue for sessionid 0x1000001a10c0017
2019-1-22 12:02:55[DEBUG](ClientCnxn.java:846) Reading reply sessionid:0x1000001a10c0017, packet:: clientPath:null serverPath:null finished:false header:: 18,2 replyHeader:: 18,29597,0 request:: '/example/customize-queue/queue-0000000319,0 response:: null
2019-1-22 12:02:55[DEBUG](DistributedQueueExample.java:74) 消费者消费消息: test-1
2019-1-22 12:02:55[DEBUG](ClientCnxn.java:846) Reading reply sessionid:0x1000001a10c0017, packet:: clientPath:/example/customize-queue serverPath:/example/customize-queue finished:false header:: 19,12 replyHeader:: 19,29597,0 request:: '/example/customize-queue,T response:: v{'queue-0000000327,'queue-0000000326,'queue-0000000325,'queue-0000000324,'queue-0000000323,'queue-0000000322,'queue-0000000321,'queue-0000000320},s{27043,27043,1547994570434,1547994570434,0,648,0,0,3,8,29597}
2019-1-22 12:02:55[DEBUG](ClientCnxn.java:846) Reading reply sessionid:0x1000001a10c0017, packet:: clientPath:null serverPath:null finished:false header:: 20,4 replyHeader:: 20,29597,0 request:: '/example/customize-queue/queue-0000000320,F response:: #01011000720746573742d322,s{29588,29588,1548129774246,1548129774246,0,0,0,0,17,0,29588}
2019-1-22 12:02:55[DEBUG](ClientCnxn.java:769) Got notification sessionid:0x1000001a10c0017
2019-1-22 12:02:55[DEBUG](ClientCnxn.java:791) Got WatchedEvent state:SyncConnected type:NodeChildrenChanged path:/example/customize-queue for sessionid 0x1000001a10c0017
2019-1-22 12:02:55[DEBUG](ClientCnxn.java:846) Reading reply sessionid:0x1000001a10c0017, packet:: clientPath:null serverPath:null finished:false header:: 21,2 replyHeader:: 21,29598,0 request:: '/example/customize-queue/queue-0000000320,0 response:: null
2019-1-22 12:02:55[DEBUG](DistributedQueueExample.java:74) 消费者消费消息: test-2
2019-1-22 12:02:55[DEBUG](ClientCnxn.java:846) Reading reply sessionid:0x1000001a10c0017, packet:: clientPath:/example/customize-queue serverPath:/example/customize-queue finished:false header:: 22,12 replyHeader:: 22,29598,0 request:: '/example/customize-queue,T response:: v{'queue-0000000327,'queue-0000000326,'queue-0000000325,'queue-0000000324,'queue-0000000323,'queue-0000000322,'queue-0000000321},s{27043,27043,1547994570434,1547994570434,0,649,0,0,3,7,29598}
2019-1-22 12:02:55[DEBUG](ClientCnxn.java:846) Reading reply sessionid:0x1000001a10c0017, packet:: clientPath:null serverPath:null finished:false header:: 23,4 replyHeader:: 23,29598,0 request:: '/example/customize-queue/queue-0000000321,F response:: #01011000720746573742d332,s{29589,29589,1548129774246,1548129774246,0,0,0,0,17,0,29589}
2019-1-22 12:02:55[DEBUG](ClientCnxn.java:769) Got notification sessionid:0x1000001a10c0017
2019-1-22 12:02:55[DEBUG](ClientCnxn.java:791) Got WatchedEvent state:SyncConnected type:NodeChildrenChanged path:/example/customize-queue for sessionid 0x1000001a10c0017
2019-1-22 12:02:55[DEBUG](ClientCnxn.java:846) Reading reply sessionid:0x1000001a10c0017, packet:: clientPath:null serverPath:null finished:false header:: 24,2 replyHeader:: 24,29599,0 request:: '/example/customize-queue/queue-0000000321,0 response:: null
2019-1-22 12:02:55[DEBUG](DistributedQueueExample.java:74) 消费者消费消息: test-3
2019-1-22 12:02:55[DEBUG](ClientCnxn.java:846) Reading reply sessionid:0x1000001a10c0017, packet:: clientPath:/example/customize-queue serverPath:/example/customize-queue finished:false header:: 25,12 replyHeader:: 25,29599,0 request:: '/example/customize-queue,T response:: v{'queue-0000000327,'queue-0000000326,'queue-0000000325,'queue-0000000324,'queue-0000000323,'queue-0000000322},s{27043,27043,1547994570434,1547994570434,0,650,0,0,3,6,29599}
2019-1-22 12:02:55[DEBUG](ClientCnxn.java:846) Reading reply sessionid:0x1000001a10c0017, packet:: clientPath:null serverPath:null finished:false header:: 26,4 replyHeader:: 26,29599,0 request:: '/example/customize-queue/queue-0000000322,F response:: #01011000720746573742d342,s{29590,29590,1548129774247,1548129774247,0,0,0,0,17,0,29590}
2019-1-22 12:02:55[DEBUG](ClientCnxn.java:769) Got notification sessionid:0x1000001a10c0017
2019-1-22 12:02:55[DEBUG](ClientCnxn.java:791) Got WatchedEvent state:SyncConnected type:NodeChildrenChanged path:/example/customize-queue for sessionid 0x1000001a10c0017
2019-1-22 12:02:55[DEBUG](ClientCnxn.java:846) Reading reply sessionid:0x1000001a10c0017, packet:: clientPath:null serverPath:null finished:false header:: 27,2 replyHeader:: 27,29600,0 request:: '/example/customize-queue/queue-0000000322,0 response:: null
2019-1-22 12:02:55[DEBUG](DistributedQueueExample.java:74) 消费者消费消息: test-4
2019-1-22 12:02:55[DEBUG](ClientCnxn.java:846) Reading reply sessionid:0x1000001a10c0017, packet:: clientPath:/example/customize-queue serverPath:/example/customize-queue finished:false header:: 28,12 replyHeader:: 28,29600,0 request:: '/example/customize-queue,T response:: v{'queue-0000000327,'queue-0000000326,'queue-0000000325,'queue-0000000324,'queue-0000000323},s{27043,27043,1547994570434,1547994570434,0,651,0,0,3,5,29600}
2019-1-22 12:02:55[DEBUG](ClientCnxn.java:846) Reading reply sessionid:0x1000001a10c0017, packet:: clientPath:null serverPath:null finished:false header:: 29,4 replyHeader:: 29,29600,0 request:: '/example/customize-queue/queue-0000000323,F response:: #01011000720746573742d352,s{29591,29591,1548129774247,1548129774247,0,0,0,0,17,0,29591}
2019-1-22 12:02:55[DEBUG](ClientCnxn.java:769) Got notification sessionid:0x1000001a10c0017
2019-1-22 12:02:55[DEBUG](ClientCnxn.java:791) Got WatchedEvent state:SyncConnected type:NodeChildrenChanged path:/example/customize-queue for sessionid 0x1000001a10c0017
2019-1-22 12:02:55[DEBUG](ClientCnxn.java:846) Reading reply sessionid:0x1000001a10c0017, packet:: clientPath:null serverPath:null finished:false header:: 30,2 replyHeader:: 30,29601,0 request:: '/example/customize-queue/queue-0000000323,0 response:: null
2019-1-22 12:02:55[DEBUG](DistributedQueueExample.java:74) 消费者消费消息: test-5
2019-1-22 12:02:55[DEBUG](ClientCnxn.java:846) Reading reply sessionid:0x1000001a10c0017, packet:: clientPath:/example/customize-queue serverPath:/example/customize-queue finished:false header:: 31,12 replyHeader:: 31,29601,0 request:: '/example/customize-queue,T response:: v{'queue-0000000327,'queue-0000000326,'queue-0000000325,'queue-0000000324},s{27043,27043,1547994570434,1547994570434,0,652,0,0,3,4,29601}
2019-1-22 12:02:55[DEBUG](ClientCnxn.java:846) Reading reply sessionid:0x1000001a10c0017, packet:: clientPath:null serverPath:null finished:false header:: 32,4 replyHeader:: 32,29601,0 request:: '/example/customize-queue/queue-0000000324,F response:: #01011000720746573742d362,s{29592,29592,1548129774247,1548129774247,0,0,0,0,17,0,29592}
2019-1-22 12:02:55[DEBUG](ClientCnxn.java:769) Got notification sessionid:0x1000001a10c0017
2019-1-22 12:02:55[DEBUG](ClientCnxn.java:791) Got WatchedEvent state:SyncConnected type:NodeChildrenChanged path:/example/customize-queue for sessionid 0x1000001a10c0017
2019-1-22 12:02:55[DEBUG](ClientCnxn.java:846) Reading reply sessionid:0x1000001a10c0017, packet:: clientPath:null serverPath:null finished:false header:: 33,2 replyHeader:: 33,29602,0 request:: '/example/customize-queue/queue-0000000324,0 response:: null
2019-1-22 12:02:55[DEBUG](DistributedQueueExample.java:74) 消费者消费消息: test-6
2019-1-22 12:02:55[DEBUG](ClientCnxn.java:846) Reading reply sessionid:0x1000001a10c0017, packet:: clientPath:/example/customize-queue serverPath:/example/customize-queue finished:false header:: 34,12 replyHeader:: 34,29602,0 request:: '/example/customize-queue,T response:: v{'queue-0000000327,'queue-0000000326,'queue-0000000325},s{27043,27043,1547994570434,1547994570434,0,653,0,0,3,3,29602}
2019-1-22 12:02:55[DEBUG](ClientCnxn.java:846) Reading reply sessionid:0x1000001a10c0017, packet:: clientPath:null serverPath:null finished:false header:: 35,4 replyHeader:: 35,29602,0 request:: '/example/customize-queue/queue-0000000325,F response:: #01011000720746573742d372,s{29593,29593,1548129774253,1548129774253,0,0,0,0,17,0,29593}
2019-1-22 12:02:55[DEBUG](ClientCnxn.java:769) Got notification sessionid:0x1000001a10c0017
2019-1-22 12:02:55[DEBUG](ClientCnxn.java:791) Got WatchedEvent state:SyncConnected type:NodeChildrenChanged path:/example/customize-queue for sessionid 0x1000001a10c0017
2019-1-22 12:02:55[DEBUG](ClientCnxn.java:846) Reading reply sessionid:0x1000001a10c0017, packet:: clientPath:null serverPath:null finished:false header:: 36,2 replyHeader:: 36,29603,0 request:: '/example/customize-queue/queue-0000000325,0 response:: null
2019-1-22 12:02:55[DEBUG](DistributedQueueExample.java:74) 消费者消费消息: test-7
2019-1-22 12:02:55[DEBUG](ClientCnxn.java:846) Reading reply sessionid:0x1000001a10c0017, packet:: clientPath:/example/customize-queue serverPath:/example/customize-queue finished:false header:: 37,12 replyHeader:: 37,29603,0 request:: '/example/customize-queue,T response:: v{'queue-0000000327,'queue-0000000326},s{27043,27043,1547994570434,1547994570434,0,654,0,0,3,2,29603}
2019-1-22 12:02:55[DEBUG](ClientCnxn.java:846) Reading reply sessionid:0x1000001a10c0017, packet:: clientPath:null serverPath:null finished:false header:: 38,4 replyHeader:: 38,29603,0 request:: '/example/customize-queue/queue-0000000326,F response:: #01011000720746573742d382,s{29594,29594,1548129774254,1548129774254,0,0,0,0,17,0,29594}
2019-1-22 12:02:55[DEBUG](ClientCnxn.java:769) Got notification sessionid:0x1000001a10c0017
2019-1-22 12:02:55[DEBUG](ClientCnxn.java:791) Got WatchedEvent state:SyncConnected type:NodeChildrenChanged path:/example/customize-queue for sessionid 0x1000001a10c0017
2019-1-22 12:02:55[DEBUG](ClientCnxn.java:846) Reading reply sessionid:0x1000001a10c0017, packet:: clientPath:null serverPath:null finished:false header:: 39,2 replyHeader:: 39,29604,0 request:: '/example/customize-queue/queue-0000000326,0 response:: null
2019-1-22 12:02:55[DEBUG](DistributedQueueExample.java:74) 消费者消费消息: test-8
2019-1-22 12:02:55[DEBUG](ClientCnxn.java:846) Reading reply sessionid:0x1000001a10c0017, packet:: clientPath:/example/customize-queue serverPath:/example/customize-queue finished:false header:: 40,12 replyHeader:: 40,29604,0 request:: '/example/customize-queue,T response:: v{'queue-0000000327},s{27043,27043,1547994570434,1547994570434,0,655,0,0,3,1,29604}
2019-1-22 12:02:55[DEBUG](ClientCnxn.java:846) Reading reply sessionid:0x1000001a10c0017, packet:: clientPath:null serverPath:null finished:false header:: 41,4 replyHeader:: 41,29604,0 request:: '/example/customize-queue/queue-0000000327,F response:: #01011000720746573742d392,s{29595,29595,1548129774254,1548129774254,0,0,0,0,17,0,29595}
2019-1-22 12:02:55[DEBUG](ClientCnxn.java:769) Got notification sessionid:0x1000001a10c0017
2019-1-22 12:02:55[DEBUG](ClientCnxn.java:791) Got WatchedEvent state:SyncConnected type:NodeChildrenChanged path:/example/customize-queue for sessionid 0x1000001a10c0017
2019-1-22 12:02:55[DEBUG](ClientCnxn.java:846) Reading reply sessionid:0x1000001a10c0017, packet:: clientPath:null serverPath:null finished:false header:: 42,2 replyHeader:: 42,29605,0 request:: '/example/customize-queue/queue-0000000327,0 response:: null
2019-1-22 12:02:55[DEBUG](DistributedQueueExample.java:74) 消费者消费消息: test-9
2019-1-22 12:02:55[DEBUG](ClientCnxn.java:846) Reading reply sessionid:0x1000001a10c0017, packet:: clientPath:/example/customize-queue serverPath:/example/customize-queue finished:false header:: 43,12 replyHeader:: 43,29605,0 request:: '/example/customize-queue,T response:: v{},s{27043,27043,1547994570434,1547994570434,0,656,0,0,3,0,29605}
2019-1-22 12:02:55[DEBUG](ClientCnxn.java:846) Reading reply sessionid:0x1000001a10c0017, packet:: clientPath:null serverPath:null finished:false header:: 44,4 replyHeader:: 44,29605,-101 request:: '/example/customize-queue/queue-0000000327,F response::
2019-1-22 12:02:56[DEBUG](ClientCnxn.java:745) Got ping response for sessionid: 0x1000001a10c0017 after 1ms
2019-1-22 12:02:58[DEBUG](ClientCnxn.java:745) Got ping response for sessionid: 0x1000001a10c0017 after 1ms