fix:In a cluster environment, verify that nodes have matching bug.

This commit is contained in:
温合民 2019-12-27 16:53:51 +08:00
parent c17fe38a6c
commit 3c6780c3cd

View File

@ -144,7 +144,7 @@ public abstract class AbstractZKClient extends ZookeeperCachedOperator{
String parentPath = getZNodeParentPath(zkNodeType);
String serverPathPrefix = parentPath + "/" + OSUtils.getHost();
String registerPath = zkClient.create().withMode(CreateMode.EPHEMERAL_SEQUENTIAL).forPath(
serverPathPrefix + "_", heartbeatZKInfo.getBytes());
serverPathPrefix + UNDERLINE, heartbeatZKInfo.getBytes());
logger.info("register {} node {} success" , zkNodeType.toString(), registerPath);
return registerPath;
}
@ -307,7 +307,7 @@ public abstract class AbstractZKClient extends ZookeeperCachedOperator{
}
Map<String, String> serverMaps = getServerMaps(zkNodeType);
for(String hostKey : serverMaps.keySet()){
if(hostKey.startsWith(host)){
if(hostKey.startsWith(host + UNDERLINE)){
return true;
}
}