public final class FallbackPolicy extends Policy
Fallback
annotation an a specific method.Modifier and Type | Field and Description |
---|---|
String |
fallbackMethod |
Method |
method |
Class<? extends org.eclipse.microprofile.faulttolerance.FallbackHandler<?>> |
value |
Constructor and Description |
---|
FallbackPolicy(Method annotated,
Class<? extends org.eclipse.microprofile.faulttolerance.FallbackHandler<?>> value,
String fallbackMethod) |
FallbackPolicy(Method annotated,
Class<? extends org.eclipse.microprofile.faulttolerance.FallbackHandler<?>> value,
String fallbackMethod,
Class<? extends Throwable>[] applyOn,
Class<? extends Throwable>[] skipOn) |
Modifier and Type | Method and Description |
---|---|
static FallbackPolicy |
create(javax.interceptor.InvocationContext context,
FaultToleranceConfig config) |
boolean |
isFallbackApplied(Throwable ex)
Helper method that checks whether or not the given exception is should trigger applying the fallback or not.
|
boolean |
isHandlerPresent() |
checkAtLeast, checkAtLeast, checkAtLeast, checkAtMost, checkReturnsSameAs, checkReturnsSameAs, describe, isCaught
public final Class<? extends org.eclipse.microprofile.faulttolerance.FallbackHandler<?>> value
public final String fallbackMethod
public final Method method
public FallbackPolicy(Method annotated, Class<? extends org.eclipse.microprofile.faulttolerance.FallbackHandler<?>> value, String fallbackMethod)
public static FallbackPolicy create(javax.interceptor.InvocationContext context, FaultToleranceConfig config)
public boolean isHandlerPresent()
public boolean isFallbackApplied(Throwable ex)
Fallback
javadocs:
When a method returns and the Fallback policy is present, the following rules are applied:
- If the method returns normally (doesn't throw), the result is simply returned.
- Otherwise, if the thrown object is assignable to any value in the
#skipOn()
parameter, the thrown object will be rethrown.- Otherwise, if the thrown object is assignable to any value in the
#applyOn()
parameter, the Fallback policy, detailed above, will be applied.- Otherwise the thrown object will be rethrown.
ex
- The exception to checkCopyright © 2021. All rights reserved.