in safeguard-impl/src/main/java/org/apache/safeguard/impl/fallback/FallbackInterceptor.java [65:98]
public Object withFallback(final InvocationContext context) {
final Map<Key, FallbackHandler<?>> handlers = cache.getHandlers();
final Key key = new Key(context, cache.getUnwrappedCache().getUnwrappedCache());
FallbackHandler<?> handler = handlers.get(key);
if (handler == null) {
handler = cache.create(context);
handlers.putIfAbsent(key, handler);
}
try {
return context.proceed();
} catch (final Throwable e) {
return handler.handle(new EnrichedExecutionContext() {
@Override
public Object getTarget() {
return context.getTarget();
}
@Override
public Method getMethod() {
return context.getMethod();
}
@Override
public Object[] getParameters() {
return context.getParameters();
}
@Override
public Throwable getFailure() {
return e;
}
});
}
}