Class RetryException
java.lang.Object
java.lang.Throwable
java.lang.Exception
org.springframework.core.retry.RetryException
- All Implemented Interfaces:
Serializable
Exception thrown when a
RetryPolicy has been exhausted or interrupted.
A RetryException will typically contain the last exception thrown
by the Retryable operation as the cause and
any exceptions from previous attempts as suppressed
exceptions.
However, if an InterruptedException is encountered while
sleeping for the current
BackOff duration, a
RetryException will contain the InterruptedException as the
cause and any exceptions from previous invocations
of the Retryable operation as suppressed
exceptions.
- Since:
- 7.0
- Author:
- Mahmoud Ben Hassine, Juergen Hoeller, Sam Brannen
- See Also:
-
Constructor Summary
ConstructorsConstructorDescriptionRetryException(String message, Throwable cause) Create a newRetryExceptionfor the supplied message and cause. -
Method Summary
Modifier and TypeMethodDescriptionfinal ThrowablegetCause()Get the last exception thrown by theRetryableoperation, or anInterruptedExceptionthrown while sleeping for the currentBackOffduration.intReturn the number of retry attempts, or 0 if no retry has been attempted after the initial invocation at all.Methods inherited from class Throwable
addSuppressed, fillInStackTrace, getLocalizedMessage, getMessage, getStackTrace, getSuppressed, initCause, printStackTrace, printStackTrace, printStackTrace, setStackTrace, toString
-
Constructor Details
-
RetryException
Create a newRetryExceptionfor the supplied message and cause.- Parameters:
message- the detail messagecause- the last exception thrown by theRetryableoperation, or anInterruptedExceptionthrown while sleeping for the currentBackOffduration
-
-
Method Details
-
getCause
Get the last exception thrown by theRetryableoperation, or anInterruptedExceptionthrown while sleeping for the currentBackOffduration. -
getRetryCount
public int getRetryCount()Return the number of retry attempts, or 0 if no retry has been attempted after the initial invocation at all.
-