Class RetryException
java.lang.Object
java.lang.Throwable
java.lang.Exception
org.springframework.core.retry.RetryException
- All Implemented Interfaces:
Serializable, RetryState
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.
Implements the RetryState interface for exposing the final outcome,
as a parameter of the terminal listener methods on RetryListener.
- 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.Return all invocation exceptions encountered, in the order of occurrence.Return the exception from the last invocation (also exposed as the cause).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, toStringMethods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface RetryState
isSuccessful
-
Constructor Details
-
RetryException
-
-
Method Details
-
getCause
-
getRetryCount
public int getRetryCount()Return the number of retry attempts, or 0 if no retry has been attempted after the initial invocation at all.- Specified by:
getRetryCountin interfaceRetryState
-
getExceptions
Return all invocation exceptions encountered, in the order of occurrence.- Specified by:
getExceptionsin interfaceRetryState- Since:
- 7.0.2
-
getLastException
Return the exception from the last invocation (also exposed as the cause).- Specified by:
getLastExceptionin interfaceRetryState- Since:
- 7.0.2
-