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.
@FunctionalInterface public interface RetryDeterminer<X extends Exception>
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 aResilientOperation.
-
-
Field Summary
Fields Modifier and Type Field Description static RetryDeterminer<Exception>ALL_ERRORSAlways retries.static RetryDeterminer<Exception>DEFAULTRetries exception when eitherSOCKET_ERRORSorSERVER_ERRORSwould retry.static RetryDeterminer<IOException>RATE_LIMIT_ERRORSA rate limited determiner that uses a defaultApiErrorExtractor.static RetryDeterminer<IOException>SERVER_ERRORSServer errors RetryDeterminer decides to retry on HttpResponseExceptions that return a 500.static RetryDeterminer<IOException>SOCKET_ERRORSSocket errors retry determiner retries on socket exceptions.
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description booleanshouldRetry(X e)Determines if we should attempt a retry depending on the caught exception.
-
-
-
Field Detail
-
DEFAULT
static final RetryDeterminer<Exception> DEFAULT
Retries exception when eitherSOCKET_ERRORSorSERVER_ERRORSwould retry.
-
ALL_ERRORS
static final RetryDeterminer<Exception> ALL_ERRORS
Always retries.
-
SOCKET_ERRORS
static final RetryDeterminer<IOException> SOCKET_ERRORS
Socket errors retry determiner retries on socket exceptions.
-
SERVER_ERRORS
static final RetryDeterminer<IOException> SERVER_ERRORS
Server errors RetryDeterminer decides to retry on HttpResponseExceptions that return a 500.
-
RATE_LIMIT_ERRORS
static final RetryDeterminer<IOException> RATE_LIMIT_ERRORS
A rate limited determiner that uses a defaultApiErrorExtractor.
-
-
Method Detail
-
shouldRetry
boolean shouldRetry(X e)
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
-
-