Did not wait for the zk session caused every operation become very slow
- Dominant language
- Java
- Stars
- 2.4k
- Forks
- 954
- PR merge metrics
- No merged PRs in 30d
Description
I can not commit or push code, so, just point out what the problem is and how to fix it.
The gui is very slow while we do any action on it, that's because every time it start up a new connection to zk server.
The problem exists in the com.deem.zkui.utils.ServletUtil.java's getZookeeper function.
It did not wait for the zk to establish connection to zk server.
'''
zk = ZooKeeperUtil.INSTANCE.createZKConnection(zkServer, zkSessionTimeout);
ZooKeeperUtil.INSTANCE.setDefaultAcl(globalProps.getProperty("defaultAcl"));
if (zk.getState() != ZooKeeper.States.CONNECTED) {
session.setAttribute("zk", null);
} else {
session.setAttribute("zk", zk);
}
'''
fix, add a sleep before check the connection status:
'''
zk = ZooKeeperUtil.INSTANCE.createZKConnection(zkServer, zkSessionTimeout);
ZooKeeperUtil.INSTANCE.setDefaultAcl(globalProps.getProperty("defaultAcl"));
while (zk.getState() == ZooKeeper.States.CONNECTING){
Thread.sleep(100);
}
if (zk.getState() != ZooKeeper.States.CONNECTED) {
session.setAttribute("zk", null);
} else {
session.setAttribute("zk", zk);
}
'''
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.