Interface FaultToleranceConfig
-
- Functional Interface:
- This is a functional interface and can therefore be used as the assignment target for a lambda expression or method reference.
@FunctionalInterface public interface FaultToleranceConfig
Encapsulates all properties extracted from FT annotations and theConfigso that the processing can be declared independent of the actual resolution mechanism. A configuration is bound to a specific invocation context which is not an argument to each of the provided methods but passed to the implementation upon construction. For another invocation another configuration instance is bound.- Author:
- Jan Bernitt
-
-
Field Summary
Fields Modifier and Type Field Description static StringALTERNATIVE_ASYNCHRONOUS_ANNNOTATIONS_PROPERTYA payara specific feature that allows to specify a list of annotation classes that have a similar effect asAsynchronous.static Class<? extends Annotation>[]NO_ALTERNATIVE_ANNOTATIONS
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description default Class<? extends Throwable>[]abortOn(org.eclipse.microprofile.faulttolerance.Retry annotation)default Class<? extends Throwable>[]applyOn(org.eclipse.microprofile.faulttolerance.Fallback annotation)static FaultToleranceConfigasAnnotated(Class<?> target, Method method)default longdelay(org.eclipse.microprofile.faulttolerance.CircuitBreaker annotation)default longdelay(org.eclipse.microprofile.faulttolerance.Retry annotation)default ChronoUnitdelayUnit(org.eclipse.microprofile.faulttolerance.CircuitBreaker annotation)default ChronoUnitdelayUnit(org.eclipse.microprofile.faulttolerance.Retry annotation)default ChronoUnitdurationUnit(org.eclipse.microprofile.faulttolerance.Retry annotation)default Class<? extends Throwable>[]failOn(org.eclipse.microprofile.faulttolerance.CircuitBreaker annotation)default doublefailureRatio(org.eclipse.microprofile.faulttolerance.CircuitBreaker annotation)default StringfallbackMethod(org.eclipse.microprofile.faulttolerance.Fallback annotation)<A extends Annotation>
AgetAnnotation(Class<A> annotationType)Returns the value of the given annotation type for the invocation context was bound to upon construction.default booleanisAlternativeAsynchronousAnnoationPresent()default booleanisAnnotationPresent(Class<? extends Annotation> annotationType)default booleanisEnabled(Class<? extends Annotation> annotationType)Check global annotation specific annotation switch.default booleanisMetricsEnabled()Check for global metrics switch.default booleanisNonFallbackEnabled()Check global generic annotation switch.default longjitter(org.eclipse.microprofile.faulttolerance.Retry annotation)default ChronoUnitjitterDelayUnit(org.eclipse.microprofile.faulttolerance.Retry annotation)default longmaxDuration(org.eclipse.microprofile.faulttolerance.Retry annotation)default intmaxRetries(org.eclipse.microprofile.faulttolerance.Retry annotation)default intrequestVolumeThreshold(org.eclipse.microprofile.faulttolerance.CircuitBreaker annotation)default Class<? extends Throwable>[]retryOn(org.eclipse.microprofile.faulttolerance.Retry annotation)default Class<? extends Throwable>[]skipOn(org.eclipse.microprofile.faulttolerance.CircuitBreaker annotation)default Class<? extends Throwable>[]skipOn(org.eclipse.microprofile.faulttolerance.Fallback annotation)default intsuccessThreshold(org.eclipse.microprofile.faulttolerance.CircuitBreaker annotation)default ChronoUnitunit(org.eclipse.microprofile.faulttolerance.Timeout annotation)default intvalue(org.eclipse.microprofile.faulttolerance.Bulkhead annotation)default Class<? extends org.eclipse.microprofile.faulttolerance.FallbackHandler<?>>value(org.eclipse.microprofile.faulttolerance.Fallback annotation)default longvalue(org.eclipse.microprofile.faulttolerance.Timeout annotation)default intwaitingTaskQueue(org.eclipse.microprofile.faulttolerance.Bulkhead annotation)
-
-
-
Field Detail
-
ALTERNATIVE_ASYNCHRONOUS_ANNNOTATIONS_PROPERTY
static final String ALTERNATIVE_ASYNCHRONOUS_ANNNOTATIONS_PROPERTY
A payara specific feature that allows to specify a list of annotation classes that have a similar effect asAsynchronous.- See Also:
- Constant Field Values
-
NO_ALTERNATIVE_ANNOTATIONS
static final Class<? extends Annotation>[] NO_ALTERNATIVE_ANNOTATIONS
-
-
Method Detail
-
asAnnotated
static FaultToleranceConfig asAnnotated(Class<?> target, Method method)
- Returns:
- A
FaultToleranceConfigthat behaves as stated by the present FT annotations.Methodannotations take precedence over theClasslevel annotations.
-
getAnnotation
<A extends Annotation> A getAnnotation(Class<A> annotationType)
Returns the value of the given annotation type for the invocation context was bound to upon construction.- Parameters:
annotationType- type to lookup- Returns:
- the annotation of the given type if present or
nullotherwise
-
isNonFallbackEnabled
default boolean isNonFallbackEnabled()
Check global generic annotation switch.- Returns:
- true if (in addition to
Fallback, which is always enabled) the other FT annotations are as well (default). Mostly used to disable these which will not disableFallback.
-
isEnabled
default boolean isEnabled(Class<? extends Annotation> annotationType)
Check global annotation specific annotation switch.- Parameters:
annotationType- the annotation type to check- Returns:
- true if the given annotation type is globally enabled, false if it is globally disabled
-
isMetricsEnabled
default boolean isMetricsEnabled()
Check for global metrics switch.- Returns:
- true if metrics are enabled, false otherwise.
-
isAnnotationPresent
default boolean isAnnotationPresent(Class<? extends Annotation> annotationType)
- See Also:
getAnnotation(Class)
-
isAlternativeAsynchronousAnnoationPresent
default boolean isAlternativeAsynchronousAnnoationPresent()
-
maxRetries
default int maxRetries(org.eclipse.microprofile.faulttolerance.Retry annotation)
-
delay
default long delay(org.eclipse.microprofile.faulttolerance.Retry annotation)
-
delayUnit
default ChronoUnit delayUnit(org.eclipse.microprofile.faulttolerance.Retry annotation)
-
maxDuration
default long maxDuration(org.eclipse.microprofile.faulttolerance.Retry annotation)
-
durationUnit
default ChronoUnit durationUnit(org.eclipse.microprofile.faulttolerance.Retry annotation)
-
jitter
default long jitter(org.eclipse.microprofile.faulttolerance.Retry annotation)
-
jitterDelayUnit
default ChronoUnit jitterDelayUnit(org.eclipse.microprofile.faulttolerance.Retry annotation)
-
retryOn
default Class<? extends Throwable>[] retryOn(org.eclipse.microprofile.faulttolerance.Retry annotation)
-
abortOn
default Class<? extends Throwable>[] abortOn(org.eclipse.microprofile.faulttolerance.Retry annotation)
-
failOn
default Class<? extends Throwable>[] failOn(org.eclipse.microprofile.faulttolerance.CircuitBreaker annotation)
-
skipOn
default Class<? extends Throwable>[] skipOn(org.eclipse.microprofile.faulttolerance.CircuitBreaker annotation)
-
delay
default long delay(org.eclipse.microprofile.faulttolerance.CircuitBreaker annotation)
-
delayUnit
default ChronoUnit delayUnit(org.eclipse.microprofile.faulttolerance.CircuitBreaker annotation)
-
requestVolumeThreshold
default int requestVolumeThreshold(org.eclipse.microprofile.faulttolerance.CircuitBreaker annotation)
-
failureRatio
default double failureRatio(org.eclipse.microprofile.faulttolerance.CircuitBreaker annotation)
-
successThreshold
default int successThreshold(org.eclipse.microprofile.faulttolerance.CircuitBreaker annotation)
-
value
default int value(org.eclipse.microprofile.faulttolerance.Bulkhead annotation)
-
waitingTaskQueue
default int waitingTaskQueue(org.eclipse.microprofile.faulttolerance.Bulkhead annotation)
-
value
default long value(org.eclipse.microprofile.faulttolerance.Timeout annotation)
-
unit
default ChronoUnit unit(org.eclipse.microprofile.faulttolerance.Timeout annotation)
-
value
default Class<? extends org.eclipse.microprofile.faulttolerance.FallbackHandler<?>> value(org.eclipse.microprofile.faulttolerance.Fallback annotation)
-
fallbackMethod
default String fallbackMethod(org.eclipse.microprofile.faulttolerance.Fallback annotation)
-
applyOn
default Class<? extends Throwable>[] applyOn(org.eclipse.microprofile.faulttolerance.Fallback annotation)
-
-