Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
apache
Shardingsphere
提交
050861f6
Shardingsphere
项目概览
apache
/
Shardingsphere
通知
56
Star
3
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
Shardingsphere
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
前往新版Gitcode,体验更适合开发者的 AI 搜索 >>
提交
050861f6
编写于
8月 07, 2018
作者:
draculav
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
use lombok
上级
3c333447
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
8 addition
and
24 deletion
+8
-24
sharding-jdbc-orchestration/src/main/java/io/shardingsphere/jdbc/orchestration/reg/newzk/client/cache/PathNode.java
...e/jdbc/orchestration/reg/newzk/client/cache/PathNode.java
+4
-20
sharding-jdbc-orchestration/src/main/java/io/shardingsphere/jdbc/orchestration/reg/newzk/client/cache/PathTree.java
...e/jdbc/orchestration/reg/newzk/client/cache/PathTree.java
+4
-4
未找到文件。
sharding-jdbc-orchestration/src/main/java/io/shardingsphere/jdbc/orchestration/reg/newzk/client/cache/PathNode.java
浏览文件 @
050861f6
...
@@ -34,8 +34,10 @@ import lombok.extern.slf4j.Slf4j;
...
@@ -34,8 +34,10 @@ import lombok.extern.slf4j.Slf4j;
@Slf4j
@Slf4j
public
final
class
PathNode
{
public
final
class
PathNode
{
@Getter
private
final
Map
<
String
,
PathNode
>
children
=
new
ConcurrentHashMap
<>();
private
final
Map
<
String
,
PathNode
>
children
=
new
ConcurrentHashMap
<>();
@Getter
private
final
String
nodeKey
;
private
final
String
nodeKey
;
@Getter
(
value
=
AccessLevel
.
PACKAGE
)
@Getter
(
value
=
AccessLevel
.
PACKAGE
)
...
@@ -56,32 +58,14 @@ public final class PathNode {
...
@@ -56,32 +58,14 @@ public final class PathNode {
this
.
path
=
key
;
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.
* Attach child node.
*
*
* @param node node
* @param node node
*/
*/
public
void
attachChild
(
final
PathNode
node
)
{
void
attachChild
(
final
PathNode
node
)
{
this
.
children
.
put
(
node
.
nodeKey
,
node
);
this
.
children
.
put
(
node
.
nodeKey
,
node
);
node
.
setPath
(
PathUtil
.
getRealPath
(
path
,
node
.
getKey
()));
node
.
setPath
(
PathUtil
.
getRealPath
(
path
,
node
.
get
Node
Key
()));
}
}
PathNode
set
(
final
PathResolve
pathResolve
,
final
String
value
)
{
PathNode
set
(
final
PathResolve
pathResolve
,
final
String
value
)
{
...
...
sharding-jdbc-orchestration/src/main/java/io/shardingsphere/jdbc/orchestration/reg/newzk/client/cache/PathTree.java
浏览文件 @
050861f6
...
@@ -92,8 +92,8 @@ public final class PathTree {
...
@@ -92,8 +92,8 @@ public final class PathTree {
log
.
debug
(
"loading status:{}"
,
status
);
log
.
debug
(
"loading status:{}"
,
status
);
status
=
PathStatus
.
CHANGING
;
status
=
PathStatus
.
CHANGING
;
final
PathNode
newRoot
=
new
PathNode
(
rootNode
.
get
().
getKey
());
final
PathNode
newRoot
=
new
PathNode
(
rootNode
.
get
().
get
Node
Key
());
final
List
<
String
>
children
=
provider
.
getChildren
(
PathUtil
.
checkPath
(
rootNode
.
get
().
getKey
()));
final
List
<
String
>
children
=
provider
.
getChildren
(
PathUtil
.
checkPath
(
rootNode
.
get
().
get
Node
Key
()));
children
.
remove
(
ZookeeperConstants
.
CHANGING_KEY
);
children
.
remove
(
ZookeeperConstants
.
CHANGING_KEY
);
attachIntoNode
(
children
,
newRoot
);
attachIntoNode
(
children
,
newRoot
);
rootNode
.
set
(
newRoot
);
rootNode
.
set
(
newRoot
);
...
@@ -190,7 +190,7 @@ public final class PathTree {
...
@@ -190,7 +190,7 @@ public final class PathTree {
* Watch data change.
* Watch data change.
*/
*/
public
void
watch
()
{
public
void
watch
()
{
watch
(
new
ZookeeperEventListener
(
rootNode
.
get
().
getKey
())
{
watch
(
new
ZookeeperEventListener
(
rootNode
.
get
().
get
Node
Key
())
{
@Override
@Override
public
void
process
(
final
WatchedEvent
event
)
{
public
void
process
(
final
WatchedEvent
event
)
{
String
path
=
event
.
getPath
();
String
path
=
event
.
getPath
();
...
@@ -222,7 +222,7 @@ public final class PathTree {
...
@@ -222,7 +222,7 @@ public final class PathTree {
}
}
final
String
key
=
zookeeperEventListener
.
getKey
();
final
String
key
=
zookeeperEventListener
.
getKey
();
log
.
debug
(
"PathTree Watch:{}"
,
key
);
log
.
debug
(
"PathTree Watch:{}"
,
key
);
client
.
registerWatch
(
rootNode
.
get
().
getKey
(),
zookeeperEventListener
);
client
.
registerWatch
(
rootNode
.
get
().
get
Node
Key
(),
zookeeperEventListener
);
watcherKeys
.
add
(
key
);
watcherKeys
.
add
(
key
);
}
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录