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 theConfig
so 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 String
ALTERNATIVE_ASYNCHRONOUS_ANNNOTATIONS_PROPERTY
A 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 FaultToleranceConfig
asAnnotated(Class<?> target, Method method)
default long
delay(org.eclipse.microprofile.faulttolerance.CircuitBreaker annotation)
default long
delay(org.eclipse.microprofile.faulttolerance.Retry annotation)
default ChronoUnit
delayUnit(org.eclipse.microprofile.faulttolerance.CircuitBreaker annotation)
default ChronoUnit
delayUnit(org.eclipse.microprofile.faulttolerance.Retry annotation)
default ChronoUnit
durationUnit(org.eclipse.microprofile.faulttolerance.Retry annotation)
default Class<? extends Throwable>[]
failOn(org.eclipse.microprofile.faulttolerance.CircuitBreaker annotation)
default double
failureRatio(org.eclipse.microprofile.faulttolerance.CircuitBreaker annotation)
default String
fallbackMethod(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 boolean
isAlternativeAsynchronousAnnoationPresent()
default boolean
isAnnotationPresent(Class<? extends Annotation> annotationType)
default boolean
isEnabled(Class<? extends Annotation> annotationType)
Check global annotation specific annotation switch.default boolean
isMetricsEnabled()
Check for global metrics switch.default boolean
isNonFallbackEnabled()
Check global generic annotation switch.default long
jitter(org.eclipse.microprofile.faulttolerance.Retry annotation)
default ChronoUnit
jitterDelayUnit(org.eclipse.microprofile.faulttolerance.Retry annotation)
default long
maxDuration(org.eclipse.microprofile.faulttolerance.Retry annotation)
default int
maxRetries(org.eclipse.microprofile.faulttolerance.Retry annotation)
default int
requestVolumeThreshold(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 int
successThreshold(org.eclipse.microprofile.faulttolerance.CircuitBreaker annotation)
default ChronoUnit
unit(org.eclipse.microprofile.faulttolerance.Timeout annotation)
default int
value(org.eclipse.microprofile.faulttolerance.Bulkhead annotation)
default Class<? extends org.eclipse.microprofile.faulttolerance.FallbackHandler<?>>
value(org.eclipse.microprofile.faulttolerance.Fallback annotation)
default long
value(org.eclipse.microprofile.faulttolerance.Timeout annotation)
default int
waitingTaskQueue(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
FaultToleranceConfig
that behaves as stated by the present FT annotations.Method
annotations take precedence over theClass
level 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
null
otherwise
-
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)
-
-