Loading sharding-jdbc-orchestration/src/main/java/io/shardingsphere/jdbc/orchestration/reg/newzk/client/cache/PathNode.java +4 −20 Original line number Diff line number Diff line Loading @@ -34,8 +34,10 @@ import lombok.extern.slf4j.Slf4j; @Slf4j public final class PathNode { @Getter private final Map<String, PathNode> children = new ConcurrentHashMap<>(); @Getter private final String nodeKey; @Getter(value = AccessLevel.PACKAGE) Loading @@ -56,32 +58,14 @@ public final class PathNode { this.path = key; } /** * Get children. * * @return children */ public Map<String, PathNode> getChildren() { return children; } /** * Get key. * * @return node key */ public String getKey() { return this.nodeKey; } /** * Attach child node. * * @param node node */ public void attachChild(final PathNode node) { void attachChild(final PathNode node) { this.children.put(node.nodeKey, node); node.setPath(PathUtil.getRealPath(path, node.getKey())); node.setPath(PathUtil.getRealPath(path, node.getNodeKey())); } PathNode set(final PathResolve pathResolve, final String value) { Loading sharding-jdbc-orchestration/src/main/java/io/shardingsphere/jdbc/orchestration/reg/newzk/client/cache/PathTree.java +4 −4 Original line number Diff line number Diff line Loading @@ -92,8 +92,8 @@ public final class PathTree { log.debug("loading status:{}", status); status = PathStatus.CHANGING; final PathNode newRoot = new PathNode(rootNode.get().getKey()); final List<String> children = provider.getChildren(PathUtil.checkPath(rootNode.get().getKey())); final PathNode newRoot = new PathNode(rootNode.get().getNodeKey()); final List<String> children = provider.getChildren(PathUtil.checkPath(rootNode.get().getNodeKey())); children.remove(ZookeeperConstants.CHANGING_KEY); attachIntoNode(children, newRoot); rootNode.set(newRoot); Loading Loading @@ -190,7 +190,7 @@ public final class PathTree { * Watch data change. */ public void watch() { watch(new ZookeeperEventListener(rootNode.get().getKey()) { watch(new ZookeeperEventListener(rootNode.get().getNodeKey()) { @Override public void process(final WatchedEvent event) { String path = event.getPath(); Loading Loading @@ -222,7 +222,7 @@ public final class PathTree { } final String key = zookeeperEventListener.getKey(); log.debug("PathTree Watch:{}", key); client.registerWatch(rootNode.get().getKey(), zookeeperEventListener); client.registerWatch(rootNode.get().getNodeKey(), zookeeperEventListener); watcherKeys.add(key); } Loading Loading
sharding-jdbc-orchestration/src/main/java/io/shardingsphere/jdbc/orchestration/reg/newzk/client/cache/PathNode.java +4 −20 Original line number Diff line number Diff line Loading @@ -34,8 +34,10 @@ import lombok.extern.slf4j.Slf4j; @Slf4j public final class PathNode { @Getter private final Map<String, PathNode> children = new ConcurrentHashMap<>(); @Getter private final String nodeKey; @Getter(value = AccessLevel.PACKAGE) Loading @@ -56,32 +58,14 @@ public final class PathNode { this.path = key; } /** * Get children. * * @return children */ public Map<String, PathNode> getChildren() { return children; } /** * Get key. * * @return node key */ public String getKey() { return this.nodeKey; } /** * Attach child node. * * @param node node */ public void attachChild(final PathNode node) { void attachChild(final PathNode node) { this.children.put(node.nodeKey, node); node.setPath(PathUtil.getRealPath(path, node.getKey())); node.setPath(PathUtil.getRealPath(path, node.getNodeKey())); } PathNode set(final PathResolve pathResolve, final String value) { Loading
sharding-jdbc-orchestration/src/main/java/io/shardingsphere/jdbc/orchestration/reg/newzk/client/cache/PathTree.java +4 −4 Original line number Diff line number Diff line Loading @@ -92,8 +92,8 @@ public final class PathTree { log.debug("loading status:{}", status); status = PathStatus.CHANGING; final PathNode newRoot = new PathNode(rootNode.get().getKey()); final List<String> children = provider.getChildren(PathUtil.checkPath(rootNode.get().getKey())); final PathNode newRoot = new PathNode(rootNode.get().getNodeKey()); final List<String> children = provider.getChildren(PathUtil.checkPath(rootNode.get().getNodeKey())); children.remove(ZookeeperConstants.CHANGING_KEY); attachIntoNode(children, newRoot); rootNode.set(newRoot); Loading Loading @@ -190,7 +190,7 @@ public final class PathTree { * Watch data change. */ public void watch() { watch(new ZookeeperEventListener(rootNode.get().getKey()) { watch(new ZookeeperEventListener(rootNode.get().getNodeKey()) { @Override public void process(final WatchedEvent event) { String path = event.getPath(); Loading Loading @@ -222,7 +222,7 @@ public final class PathTree { } final String key = zookeeperEventListener.getKey(); log.debug("PathTree Watch:{}", key); client.registerWatch(rootNode.get().getKey(), zookeeperEventListener); client.registerWatch(rootNode.get().getNodeKey(), zookeeperEventListener); watcherKeys.add(key); } Loading