use of org.apache.ratis.retry.RetryPolicy in project alluxio by Alluxio.
the class RaftJournalSystem method createClient.
private RaftClient createClient() {
long timeoutMs = ServerConfiguration.getMs(PropertyKey.MASTER_EMBEDDED_JOURNAL_RAFT_CLIENT_REQUEST_TIMEOUT);
long retryBaseMs = ServerConfiguration.getMs(PropertyKey.MASTER_EMBEDDED_JOURNAL_RAFT_CLIENT_REQUEST_INTERVAL);
RaftProperties properties = new RaftProperties();
Parameters parameters = new Parameters();
RaftClientConfigKeys.Rpc.setRequestTimeout(properties, TimeDuration.valueOf(timeoutMs, TimeUnit.MILLISECONDS));
RetryPolicy retryPolicy = ExponentialBackoffRetry.newBuilder().setBaseSleepTime(TimeDuration.valueOf(retryBaseMs, TimeUnit.MILLISECONDS)).setMaxSleepTime(TimeDuration.valueOf(mConf.getMaxElectionTimeoutMs(), TimeUnit.MILLISECONDS)).build();
return RaftClient.newBuilder().setRaftGroup(mRaftGroup).setClientId(mClientId).setLeaderId(null).setProperties(properties).setParameters(parameters).setRetryPolicy(retryPolicy).build();
}
Aggregations