Class NeverRethrowMethodExceptionPolicy
java.lang.Object
com.societegenerale.failover.core.exception.policy.NeverRethrowMethodExceptionPolicy
- All Implemented Interfaces:
MethodExceptionPolicy
MethodExceptionPolicy that never rethrows: it always returns the recovered result,
suppressing the original exception in every case.
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) — returnnull(or theRecoveredPayloadHandlerfallback) without rethrowing. The caller cannot tell an outage occurred from the return value alone.
This is the most lenient policy: callers are never interrupted, at the cost of masking
upstream outages from the caller. Because the failure is invisible to the caller, the outage
must be observed through metrics — the recover event still fires regardless of policy, so
failover.recovery.outcome.total (outcome not_recovered) and
failover.user.impact.total (impact blocked) remain the signal to alert on.
Contrast RethrowIfNoRecoveryMethodExceptionPolicy, the default, which rethrows when there
is nothing to recover so the outage surfaces to the caller.
- Author:
- Anand Manissery
- See Also:
-
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
-