/**
* Return true if any of the states is achieved
*/
public static boolean waitForServerState(QuorumPeer qp, int timeout,
String... serverStates) {
long start = Time.currentElapsedTime();
while (true) {
try {
Thread.sleep(250);
} catch (InterruptedException e) {
// ignore
}
for (String state : serverStates) {
if (qp.getServerState().equals(state)) {
return true;
}
}
if (Time.currentElapsedTime() > start + timeout) {
return false;
}
}
}
ClientBase.java 文件源码
java
阅读 34
收藏 0
点赞 0
评论 0
项目:https-github.com-apache-zookeeper
作者:
评论列表
文章目录