Class NeverRethrowMethodExceptionPolicy
java.lang.Object
com.societegenerale.failover.core.exception.policy.NeverRethrowMethodExceptionPolicy
- All Implemented Interfaces:
MethodExceptionPolicy
MethodExceptionPolicy that serves recovered data when available, and cascades
the original exception only when there is nothing to recover.
Decision logic:
- If
recoveredResultis non-null — return it; the caller is served stale data transparently and the failure is hidden. - If
recoveredResultisnull(store miss, expiry, or store failure) — rethrow the original exception so the caller can react to the outage explicitly.
This is the "best-effort" policy: prefer stale data, but be honest when even that is unavailable.
- Author:
- Anand Manissery
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescription<T> Thandle(MethodExceptionContext<T> context) Handles the exception context and returns the value to return to the caller, or throws to propagate the failure.
-
Constructor Details
-
NeverRethrowMethodExceptionPolicy
public NeverRethrowMethodExceptionPolicy()
-
-
Method Details
-
handle
Description copied from interface:MethodExceptionPolicyHandles the exception context and returns the value to return to the caller, or throws to propagate the failure.- Specified by:
handlein interfaceMethodExceptionPolicy- Type Parameters:
T- the return type of the intercepted method- Parameters:
context- all available information about the failure and recovery attempt- Returns:
- the value to return to the caller; may be
null
-