Package org.apache.hadoop.io.retry
Class RetryUtils
java.lang.Object
org.apache.hadoop.io.retry.RetryUtils
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic RetryPolicygetDefaultRetryPolicy(Configuration conf, String retryPolicyEnabledKey, boolean defaultRetryPolicyEnabled, String retryPolicySpecKey, String defaultRetryPolicySpec, String remoteExceptionToRetry) Return the default retry policy set in conf.static RetryPolicygetMultipleLinearRandomRetry(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.
-
Field Details
-
LOG
public static final org.slf4j.Logger LOG
-
-
Constructor Details
-
RetryUtils
public RetryUtils()
-
-
Method Details
-
getDefaultRetryPolicy
public static RetryPolicy getDefaultRetryPolicy(Configuration conf, String retryPolicyEnabledKey, boolean defaultRetryPolicyEnabled, String retryPolicySpecKey, String defaultRetryPolicySpec, String remoteExceptionToRetry) 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, or - ServiceException; and (2) use TRY_ONCE_THEN_FAIL for - non-remoteExceptionToRetry RemoteException, or - non-IOException.- Parameters:
conf- configuration.retryPolicyEnabledKey- conf property key for enabling retrydefaultRetryPolicyEnabled- default retryPolicyEnabledKey conf valueretryPolicySpecKey- conf property key for retry policy specdefaultRetryPolicySpec- default retryPolicySpecKey conf valueremoteExceptionToRetry- The particular RemoteException 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- configuration.retryPolicyEnabledKey- conf property key for enabling retrydefaultRetryPolicyEnabled- default retryPolicyEnabledKey conf valueretryPolicySpecKey- conf property key for retry policy specdefaultRetryPolicySpec- default retryPolicySpecKey conf value- Returns:
- the MultipleLinearRandomRetry policy specified in the conf, or null if the feature is disabled.
-