Search in sources :

Example 1 with ExponentialBackoffPolicyWithLimit

use of org.apache.hadoop.hbase.util.RetryCounter.ExponentialBackoffPolicyWithLimit in project hbase by apache.

the class ProcedureUtil method createRetryCounter.

/**
 * Get a retry counter for getting the backoff time. We will use the
 * {@link ExponentialBackoffPolicyWithLimit} policy, and the base unit is 1 second, max sleep time
 * is 10 minutes by default.
 * <p/>
 * For UTs, you can set the {@link #PROCEDURE_RETRY_SLEEP_INTERVAL_MS} and
 * {@link #PROCEDURE_RETRY_MAX_SLEEP_TIME_MS} to make more frequent retry so your UT will not
 * timeout.
 */
public static RetryCounter createRetryCounter(Configuration conf) {
    long sleepIntervalMs = conf.getLong(PROCEDURE_RETRY_SLEEP_INTERVAL_MS, DEFAULT_PROCEDURE_RETRY_SLEEP_INTERVAL_MS);
    long maxSleepTimeMs = conf.getLong(PROCEDURE_RETRY_MAX_SLEEP_TIME_MS, DEFAULT_PROCEDURE_RETRY_MAX_SLEEP_TIME_MS);
    RetryConfig retryConfig = new RetryConfig().setSleepInterval(sleepIntervalMs).setMaxSleepTime(maxSleepTimeMs).setBackoffPolicy(new ExponentialBackoffPolicyWithLimit());
    return new RetryCounter(retryConfig);
}
Also used : ExponentialBackoffPolicyWithLimit(org.apache.hadoop.hbase.util.RetryCounter.ExponentialBackoffPolicyWithLimit) RetryConfig(org.apache.hadoop.hbase.util.RetryCounter.RetryConfig) RetryCounter(org.apache.hadoop.hbase.util.RetryCounter)

Aggregations

RetryCounter (org.apache.hadoop.hbase.util.RetryCounter)1 ExponentialBackoffPolicyWithLimit (org.apache.hadoop.hbase.util.RetryCounter.ExponentialBackoffPolicyWithLimit)1 RetryConfig (org.apache.hadoop.hbase.util.RetryCounter.RetryConfig)1