From 99cbbd51d983ab2b090c79c6c103b040277587f0 Mon Sep 17 00:00:00 2001 From: "lee123lee123@163.com" Date: Fri, 3 Nov 2017 16:35:47 +0800 Subject: [PATCH] bugfix --- .../src/main/java/com/gopush/common/utils/zk/ZkUtils.java | 5 +---- .../main/java/com/gopush/datacenter/nodes/manager/Node.java | 4 ++-- .../com/gopush/datacenter/nodes/manager/NodeManager.java | 4 ++-- .../java/com/gopush/nodeserver/devices/BatchProcessor.java | 3 +-- .../src/main/java/com/gopush/protocol/node/NodeMessage.java | 3 ++- 5 files changed, 8 insertions(+), 11 deletions(-) diff --git a/go-push-common/src/main/java/com/gopush/common/utils/zk/ZkUtils.java b/go-push-common/src/main/java/com/gopush/common/utils/zk/ZkUtils.java index 7c60f31..c7f8388 100644 --- a/go-push-common/src/main/java/com/gopush/common/utils/zk/ZkUtils.java +++ b/go-push-common/src/main/java/com/gopush/common/utils/zk/ZkUtils.java @@ -305,14 +305,11 @@ public class ZkUtils { if (stat != null) { PathChildrenCache watcher = new PathChildrenCache(zkClient, path, true); watcher.start(PathChildrenCache.StartMode.POST_INITIALIZED_EVENT); - //该模式下 watcher在重连的时候会自动 rebuild + //该模式下 watcher在重连的时候会自动 rebuild 否则需要重新rebuild watcher.getListenable().addListener(biConsumer::accept, pool); if (!pathChildrenCaches.contains(watcher)) { pathChildrenCaches.add(watcher); } -// else{ -// watcher.rebuild(); -// } return Boolean.TRUE; } } catch (Exception e) { diff --git a/go-push-data-center/src/main/java/com/gopush/datacenter/nodes/manager/Node.java b/go-push-data-center/src/main/java/com/gopush/datacenter/nodes/manager/Node.java index c1ca578..fec0235 100644 --- a/go-push-data-center/src/main/java/com/gopush/datacenter/nodes/manager/Node.java +++ b/go-push-data-center/src/main/java/com/gopush/datacenter/nodes/manager/Node.java @@ -119,7 +119,7 @@ public class Node implements INode { @Override public void init() { -// log.info("node init ........"); + log.info("node init ........"); destroyed = Boolean.FALSE; try { connect(); @@ -133,7 +133,7 @@ public class Node implements INode { @Override public void destroy() { -// log.info("node -------> destroy"); + log.info("node -------> destroy"); if (failMessage != null) { if (!failMessage.isEmpty()) { log.info("destroy node lost retry messages: {}", failMessage.toString()); diff --git a/go-push-data-center/src/main/java/com/gopush/datacenter/nodes/manager/NodeManager.java b/go-push-data-center/src/main/java/com/gopush/datacenter/nodes/manager/NodeManager.java index bcbb5a6..98ae2d5 100644 --- a/go-push-data-center/src/main/java/com/gopush/datacenter/nodes/manager/NodeManager.java +++ b/go-push-data-center/src/main/java/com/gopush/datacenter/nodes/manager/NodeManager.java @@ -51,7 +51,7 @@ public class NodeManager { public void remove(String nodeName) { -// log.info("node remove---------{}",nodeName); + log.info("node remove---------{}",nodeName); if (nodeChannelPool.containsKey(nodeName)) { nodeChannelPool.get(nodeName).destroy(); nodeChannelPool.remove(nodeName); @@ -62,7 +62,7 @@ public class NodeManager { String intranetIp, int nodePort, String internetIp, int devicePort) { remove(nodeName); -// log.info("node add---------",nodeName); + log.info("node add---------",nodeName); Node node = new Node(nodeName + "-client", intranetIp, nodePort, internetIp, devicePort, group, nodeMessageHandlers); node.init(); nodeChannelPool.put(nodeName, node); diff --git a/go-push-node-server/src/main/java/com/gopush/nodeserver/devices/BatchProcessor.java b/go-push-node-server/src/main/java/com/gopush/nodeserver/devices/BatchProcessor.java index 4f8eeea..430a6d3 100644 --- a/go-push-node-server/src/main/java/com/gopush/nodeserver/devices/BatchProcessor.java +++ b/go-push-node-server/src/main/java/com/gopush/nodeserver/devices/BatchProcessor.java @@ -194,9 +194,8 @@ public abstract class BatchProcessor { */ private void processInterval() { -// log.info(" ...... {} ",processorInfo().toString()); + log.info(" ...... {} ",processorInfo().toString()); - //不管三七二十一先处理一次 int batchSize = batchProcessorConfig.getBatchSize(); do { if (this.queue.isEmpty()) { diff --git a/go-push-protocol-node/src/main/java/com/gopush/protocol/node/NodeMessage.java b/go-push-protocol-node/src/main/java/com/gopush/protocol/node/NodeMessage.java index 41b661a..811fab8 100755 --- a/go-push-protocol-node/src/main/java/com/gopush/protocol/node/NodeMessage.java +++ b/go-push-protocol-node/src/main/java/com/gopush/protocol/node/NodeMessage.java @@ -7,6 +7,7 @@ import lombok.AllArgsConstructor; import lombok.Builder; import lombok.Data; import lombok.NoArgsConstructor; +import lombok.extern.slf4j.Slf4j; /** * go-push @@ -83,7 +84,7 @@ public abstract class NodeMessage { .type(type()) .message(toEncode()) .build(); -// System.out.println("Node message json: "+ JSON.toJSONString(message)); + System.out.println("Node message json: "+ JSON.toJSONString(message)); return JSON.toJSONString(message); } catch (Exception e) { throw new NodeProtocolException(e); -- Gitee