use of org.jboss.netty.handler.timeout.TimeoutException in project graphdb by neo4j-attic.
the class LocalhostZooKeeperCluster method await.
private void await(ZooKeeper[] keepers, long timeout, TimeUnit unit) {
timeout = System.currentTimeMillis() + unit.toMillis(timeout);
do {
ClusterManager cm = null;
try {
cm = new ClusterManager(getConnectionString());
cm.waitForSyncConnected();
break;
} catch (Exception e) {
e.printStackTrace();
// ok retry
} finally {
if (cm != null) {
try {
cm.shutdown();
} catch (Throwable t) {
t.printStackTrace();
}
}
}
if (System.currentTimeMillis() > timeout) {
throw new TimeoutException("waiting for ZooKeeper cluster to start");
}
try {
Thread.sleep(2000);
} catch (InterruptedException e) {
Thread.interrupted();
}
} while (true);
}
Aggregations