return false;
}
// everything in cache is also in map
for (String path : cache.keySet()) {
ZNode cacheNode = cache.get(path);
ZNode zkNode = zkMap.get(path);
if (zkNode == null) {
// in cache but not on zk
System.err.println("path: " + path + " in cache but not on zk: inCacheNode: " + cacheNode);
return false;
}
if ((zkNode.getData() == null && cacheNode.getData() != null)
|| (zkNode.getData() != null && cacheNode.getData() == null)
|| (zkNode.getData() != null && cacheNode.getData() != null && !zkNode.getData().equals(
cacheNode.getData()))) {
// data not equal
System.err.println("data mismatch on path: " + path + ", inCache: " + cacheNode.getData()
+ ", onZk: " + zkNode.getData());
return false;
}
if ((zkNode.getChildSet() == null && cacheNode.getChildSet() != null)
|| (zkNode.getChildSet() != null && cacheNode.getChildSet() == null)
|| (zkNode.getChildSet() != null && cacheNode.getChildSet() != null && !zkNode
.getChildSet().equals(cacheNode.getChildSet()))) {
// childSet not equal
System.err.println("childSet mismatch on path: " + path + ", inCache: "
+ cacheNode.getChildSet() + ", onZk: " + zkNode.getChildSet());
return false;
}
if (needVerifyStat && pathsExcludeForStat != null && !pathsExcludeForStat.contains(path)) {
if (cacheNode.getStat() == null || !zkNode.getStat().equals(cacheNode.getStat())) {
// stat not equal
System.err.println("Stat mismatch on path: " + path + ", inCache: " + cacheNode.getStat()
+ ", onZk: " + zkNode.getStat());
return false;
}
}
}