Search in sources :

Example 1 with RetryPolicy

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();
}
Also used : Parameters(org.apache.ratis.conf.Parameters) RaftProperties(org.apache.ratis.conf.RaftProperties) RetryPolicy(org.apache.ratis.retry.RetryPolicy)

Aggregations

Parameters (org.apache.ratis.conf.Parameters)1 RaftProperties (org.apache.ratis.conf.RaftProperties)1 RetryPolicy (org.apache.ratis.retry.RetryPolicy)1