Package com.google.cloud.hadoop.util
Interface RetryDeterminer<X extends Exception>
- Type Parameters:
X- The type of exception you are checking and could possibly return.
- Functional Interface:
- This is a functional interface and can therefore be used as the assignment target for a lambda expression or method reference.
This abstract class is designed to tell if an exception is transient and should result in a retry
or not, and should result in a returned exception to the caller. Meant to be used with a
ResilientOperation.-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final RetryDeterminer<Exception>Always retries.static final RetryDeterminer<Exception>Retries exception when eitherSOCKET_ERRORSorSERVER_ERRORSwould retry.static final RetryDeterminer<IOException>A rate limited determiner that uses a defaultApiErrorExtractor.static final RetryDeterminer<IOException>Server errors RetryDeterminer decides to retry on HttpResponseExceptions that return a 500.static final RetryDeterminer<IOException>Socket errors retry determiner retries on socket exceptions. -
Method Summary
Modifier and TypeMethodDescriptionbooleanshouldRetry(X e) Determines if we should attempt a retry depending on the caught exception.
-
Field Details
-
DEFAULT
Retries exception when eitherSOCKET_ERRORSorSERVER_ERRORSwould retry. -
ALL_ERRORS
Always retries. -
SOCKET_ERRORS
Socket errors retry determiner retries on socket exceptions. -
SERVER_ERRORS
Server errors RetryDeterminer decides to retry on HttpResponseExceptions that return a 500. -
RATE_LIMIT_ERRORS
A rate limited determiner that uses a defaultApiErrorExtractor.
-
-
Method Details
-
shouldRetry
Determines if we should attempt a retry depending on the caught exception.To indicate that no retry should be made, return false. If no retry, the exception should be returned to the user.
- Parameters:
e- Exception of type X that can be examined to determine if a retry is possible.- Returns:
- true if should retry, false otherwise
-