Class AdvancedFailoverHandler<T>
java.lang.Object
com.societegenerale.failover.core.AdvancedFailoverHandler<T>
- Type Parameters:
T- the type of the payload managed by this handler
- All Implemented Interfaces:
FailoverHandler<T>
FailoverHandler decorator that publishes metrics on every store/recover operation
and delegates payload post-processing to a RecoveredPayloadHandler.
This is the outermost handler — its store/recover fire once per intercepted
method call (the composite), so the metrics it publishes are at method-call granularity (e.g.
a single findAll() is one recover event, not one per slice). Each metric carries the
intercepted method and the failover domain; the method is forwarded downstream.
- Author:
- Anand Manissery
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidclean()Removes all expired entries from the failover store.recover(@NonNull Failover failover, @NonNull Method method, List<Object> args, Class<T> clazz, Throwable cause) Recovers a previously stored payload after a failure.Stores the payload for later recovery.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface com.societegenerale.failover.core.FailoverHandler
recoverAll
-
Constructor Details
-
AdvancedFailoverHandler
public AdvancedFailoverHandler()
-
-
Method Details
-
store
Description copied from interface:FailoverHandlerStores the payload for later recovery.- Specified by:
storein interfaceFailoverHandler<T>- Parameters:
failover- annotation metadata for the failover pointmethod- the reflected intercepted method (nevernull)args- method arguments used to derive the store keypayload- the result to store- Returns:
- the stored payload
-
recover
public T recover(@NonNull Failover failover, @NonNull Method method, List<Object> args, Class<T> clazz, Throwable cause) Description copied from interface:FailoverHandlerRecovers a previously stored payload after a failure.- Specified by:
recoverin interfaceFailoverHandler<T>- Parameters:
failover- annotation metadata for the failover pointmethod- the reflected intercepted method (nevernull)args- method arguments used to derive the lookup keyclazz- expected return typecause- the exception that triggered recovery- Returns:
- the recovered payload, or
nullif not found or expired
-
clean
public void clean()Description copied from interface:FailoverHandlerRemoves all expired entries from the failover store.- Specified by:
cleanin interfaceFailoverHandler<T>
-