use of org.apache.ignite.raft.jraft.rpc.RpcServer in project ignite-3 by apache.
the class ItNodeTest method waitForTopology.
/**
* TODO asch get rid of waiting for topology IGNITE-14832
*
* @param cluster
* @param addr
* @param expected
* @param timeout
* @return
*/
private boolean waitForTopology(TestCluster cluster, Endpoint addr, int expected, long timeout) {
RaftGroupService grp = cluster.getServer(addr);
if (grp == null) {
LOG.warn("Node has not been found {}", addr);
return false;
}
RpcServer rpcServer = grp.getRpcServer();
if (!(rpcServer instanceof IgniteRpcServer))
return true;
ClusterService service = ((IgniteRpcServer) grp.getRpcServer()).clusterService();
long stop = System.currentTimeMillis() + timeout;
while (System.currentTimeMillis() < stop) {
if (service.topologyService().allMembers().size() >= expected)
return true;
try {
Thread.sleep(50);
} catch (InterruptedException e) {
return false;
}
}
return false;
}
Aggregations