## org.apache.hadoop.io.retry
Class RetryUtils

    java.lang.Object
      org.apache.hadoop.io.retry.RetryUtils

    public class RetryUtils

extends Object

Field Summary
`static org.apache.commons.logging.Log` `LOG`

Constructor Summary
`RetryUtils()`

Method Summary
`static RetryPolicy` `getDefaultRetryPolicy(Configuration conf, String retryPolicyEnabledKey, boolean defaultRetryPolicyEnabled, String retryPolicySpecKey, String defaultRetryPolicySpec, Class<? extends Exception>... remoteExceptionsToRetry)` Return the default retry policy set in conf.
`static RetryPolicy` `getMultipleLinearRandomRetry(Configuration conf, String retryPolicyEnabledKey, boolean defaultRetryPolicyEnabled, String retryPolicySpecKey, String defaultRetryPolicySpec)` Return the MultipleLinearRandomRetry policy specified in the conf, or null if the feature is disabled.

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Field Detail

### LOG

    public static final org.apache.commons.logging.Log LOG

Constructor Detail

### RetryUtils

    public RetryUtils()

Method Detail

### getDefaultRetryPolicy

    public static RetryPolicy getDefaultRetryPolicy(Configuration conf,
                                                    String retryPolicyEnabledKey,
                                                    boolean defaultRetryPolicyEnabled,
                                                    String retryPolicySpecKey,
                                                    String defaultRetryPolicySpec,
                                                    Class<? extends Exception>... remoteExceptionsToRetry)

  Return the default retry policy set in conf. If the value retryPolicyEnabledKey is set to false in conf, use TRY_ONCE_THEN_FAIL. Otherwise, get the MultipleLinearRandomRetry policy specified in the conf and then (1) use multipleLinearRandomRetry for - remoteExceptionToRetry, or - IOException other than RemoteException; and (2) use TRY_ONCE_THEN_FAIL for - RemoteException other than remoteExceptionToRetry, or - non-IOException.

  Parameters:
    `conf` -
    `retryPolicyEnabledKey` - conf property key for enabling retry
    `defaultRetryPolicyEnabled` - default retryPolicyEnabledKey conf value
    `retryPolicySpecKey` - conf property key for retry policy spec
    `defaultRetryPolicySpec` - default retryPolicySpecKey conf value
    `remoteExceptionsToRetry` - The particular RemoteExceptions to retry
  Returns:
    the default retry policy.

### getMultipleLinearRandomRetry

    public static RetryPolicy getMultipleLinearRandomRetry(Configuration conf,
                                                           String retryPolicyEnabledKey,
                                                           boolean defaultRetryPolicyEnabled,
                                                           String retryPolicySpecKey,
                                                           String defaultRetryPolicySpec)

  Return the MultipleLinearRandomRetry policy specified in the conf, or null if the feature is disabled. If the policy is specified in the conf but the policy cannot be parsed, the default policy is returned. Retry policy spec: N pairs of sleep-time and number-of-retries "s1,n1,s2,n2,..."

  Parameters:
    `conf` -
    `retryPolicyEnabledKey` - conf property key for enabling retry
    `defaultRetryPolicyEnabled` - default retryPolicyEnabledKey conf value
    `retryPolicySpecKey` - conf property key for retry policy spec
    `defaultRetryPolicySpec` - default retryPolicySpecKey conf value
  Returns:
    the MultipleLinearRandomRetry policy specified in the conf, or null if the feature is disabled.

Copyright © 2009 The Apache Software Foundation