Class RecoverAnnotationRecoveryHandler<T>
java.lang.Object
org.springframework.retry.annotation.RecoverAnnotationRecoveryHandler<T>
- Type Parameters:
T
- the type of the return value from the recovery
- All Implemented Interfaces:
MethodInvocationRecoverer<T>
public class RecoverAnnotationRecoveryHandler<T>
extends Object
implements MethodInvocationRecoverer<T>
A recoverer for method invocations based on the
@Recover
annotation. A
suitable recovery method is one with a Throwable type as the first parameter and the
same return type and arguments as the method that failed. The Throwable first argument
is optional and if omitted the method is treated as a default (called when there are no
other matches). Generally the best matching method is chosen based on the type of the
first parameter and the type of the exception being handled. The closest match in the
class hierarchy is chosen, so for instance if an IllegalArgumentException is being
handled and there is a method whose first argument is RuntimeException, then it will be
preferred over a method whose first argument is Throwable.- Author:
- Dave Syer, Josh Long, Aldo Sinanaj, Randell Callahan, Nathanaƫl Roberts, Maksim Kita, Gary Russell, Artem Bilan, Gianluca Medici, Lijinliang, Yanming Zhou
-
Constructor Summary
-
Method Summary
-
Constructor Details
-
RecoverAnnotationRecoveryHandler
-
-
Method Details
-
recover
Description copied from interface:MethodInvocationRecoverer
Recover gracefully from an error. Clients can call this if processing of the item throws an unexpected exception. Caller can use the return value to decide whether to try more corrective action or perhaps throw an exception.- Specified by:
recover
in interfaceMethodInvocationRecoverer<T>
- Parameters:
args
- the arguments for the method invocation that failed.cause
- the cause of the failure that led to this recovery.- Returns:
- the value to be returned to the caller
-