Package org.apache.hadoop.io.retry
Interface RetryPolicy
- All Known Implementing Classes:
RetryPolicies.MultipleLinearRandomRetry
@Evolving
public interface RetryPolicy
Specifies a policy for retrying method failures. Implementations of this interface should be immutable.
-
Nested Class Summary
Nested ClassesModifier and TypeInterfaceDescriptionstatic classReturned byshouldRetry(Exception, int, int, boolean). -
Method Summary
Modifier and TypeMethodDescriptionshouldRetry(Exception e, int retries, int failovers, boolean isIdempotentOrAtMostOnce) Determines whether the framework should retry a method for the given exception, and the number of retries that have been made for that operation so far.
-
Method Details
-
shouldRetry
RetryPolicy.RetryAction shouldRetry(Exception e, int retries, int failovers, boolean isIdempotentOrAtMostOnce) throws Exception Determines whether the framework should retry a method for the given exception, and the number of retries that have been made for that operation so far.
- Parameters:
e- The exception that caused the method to failretries- The number of times the method has been retriedfailovers- The number of times the method has failed over to a different backend implementationisIdempotentOrAtMostOnce-trueif the method isIdempotentorAtMostOnceand so can reasonably be retried on failover when we don't know if the previous attempt reached the server or not- Returns:
RetryPolicy.RetryActionwithRetryDecision.FAILif the method should not be retried,RetryDecision.RETRYif the method should be retried orRetryDecision.FAILOVER_AND_RETRYif failover has to be performed before retry.- Throws:
Exception- The re-thrown exceptioneindicating that the method failed and should not be retried further
-