Search in sources :

Example 1 with RpcServer

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;
}
Also used : ClusterService(org.apache.ignite.network.ClusterService) RaftGroupService(org.apache.ignite.raft.jraft.RaftGroupService) RpcServer(org.apache.ignite.raft.jraft.rpc.RpcServer) IgniteRpcServer(org.apache.ignite.raft.jraft.rpc.impl.IgniteRpcServer) TestIgniteRpcServer(org.apache.ignite.raft.jraft.rpc.TestIgniteRpcServer) IgniteRpcServer(org.apache.ignite.raft.jraft.rpc.impl.IgniteRpcServer) TestIgniteRpcServer(org.apache.ignite.raft.jraft.rpc.TestIgniteRpcServer)

Aggregations

ClusterService (org.apache.ignite.network.ClusterService)1 RaftGroupService (org.apache.ignite.raft.jraft.RaftGroupService)1 RpcServer (org.apache.ignite.raft.jraft.rpc.RpcServer)1 TestIgniteRpcServer (org.apache.ignite.raft.jraft.rpc.TestIgniteRpcServer)1 IgniteRpcServer (org.apache.ignite.raft.jraft.rpc.impl.IgniteRpcServer)1