use of org.apache.accumulo.core.replication.thrift.ReplicationCoordinator in project accumulo by apache.
the class ReplicationClient method getCoordinatorConnectionWithRetry.
/**
* @param context
* the client session for the peer replicant
* @return Client to the ReplicationCoordinator service
*/
public static ReplicationCoordinator.Client getCoordinatorConnectionWithRetry(ClientContext context) throws AccumuloException {
requireNonNull(context);
Instance instance = context.getInstance();
for (int attempts = 1; attempts <= 10; attempts++) {
ReplicationCoordinator.Client result = getCoordinatorConnection(context);
if (result != null)
return result;
log.debug("Could not get ReplicationCoordinator connection to {}, will retry", instance.getInstanceName());
try {
Thread.sleep(attempts * 250);
} catch (InterruptedException e) {
throw new AccumuloException(e);
}
}
throw new AccumuloException("Timed out trying to communicate with master from " + instance.getInstanceName());
}
Aggregations