Annotation Interface Retry
When annotated on a public/protected/package-private method in a Guice-constructed object this annotation will automatically
retry if that method throws an exception
-
Optional Element Summary
Modifier and TypeOptional ElementDescriptiondouble
The amount to multiply backoff time by for each failurelong
the backoff wait amountThe backoff wait unitThe exception types which, if thrown, will bypass retry logic altogetherThe core exception types which, if thrown, will bypass retry logic altogether.
These are set to sensible defaults for regular Java code (Errors, IllegalArgumentExceptions and NullPointerExceptions)int[]
If aRestException
is thrown then if the HTTP Code is one of these values we don't retry.int
The maximum number of attempts before the exception is thrown as normalThe exception types which, if thrown, will cause retry.
-
Element Details
-
backoffTime
long backoffTimethe backoff wait amount- Returns:
- Default:
- 1000L
-
backoffUnit
TimeUnit backoffUnitThe backoff wait unit- Returns:
- Default:
- MILLISECONDS
-
backoffExponent
double backoffExponentThe amount to multiply backoff time by for each failure- Returns:
- Default:
- 2.0
-
maxAttempts
int maxAttemptsThe maximum number of attempts before the exception is thrown as normal- Returns:
- Default:
- 3
-
on
The exception types which, if thrown, will cause retry. Exceptions specified in this list will bypass any exceptions listed in exceptOn or exceptOnCore- Returns:
- Default:
- {}
-
exceptOn
The exception types which, if thrown, will bypass retry logic altogether- Returns:
- Default:
- {}
-
exceptOnCore
The core exception types which, if thrown, will bypass retry logic altogether.
These are set to sensible defaults for regular Java code (Errors, IllegalArgumentExceptions and NullPointerExceptions)- Returns:
- Default:
- {java.lang.Error.class, java.lang.IllegalArgumentException.class, java.lang.NullPointerException.class}
-
exceptOnRestExceptionCodes
int[] exceptOnRestExceptionCodesIf aRestException
is thrown then if the HTTP Code is one of these values we don't retry. N.B. server-side we also consider an HTTP 303 redirection with a cause RestException having one of these codes- Returns:
- Default:
- {403, 401, 400, 303}
-