未验证 提交 3f365ffd 编写于 作者: ShardingSphere's avatar ShardingSphere 提交者: GitHub

Merge pull request #1108 from saaavsaaa/dev

use lombok getter
......@@ -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)
......@@ -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) {
......
......@@ -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);
......@@ -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();
......@@ -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);
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册