public interface FaultToleranceService
Modifier and Type | Method and Description |
---|---|
void |
delay(long delayMillis,
javax.interceptor.InvocationContext context)
Delays the current thread by the given duration.
|
void |
endTrace()
Ends the innermost trace.
|
Object |
fallbackHandle(Class<? extends org.eclipse.microprofile.faulttolerance.FallbackHandler<?>> fallbackClass,
javax.interceptor.InvocationContext context,
Exception ex)
|
Object |
fallbackInvoke(Method fallbackMethod,
javax.interceptor.InvocationContext context)
Invokes the given fallback
Method in the given context. |
BulkheadSemaphore |
getConcurrentExecutions(int maxConcurrentThreads,
javax.interceptor.InvocationContext context) |
FaultToleranceConfig |
getConfig(javax.interceptor.InvocationContext context,
Stereotypes stereotypes)
Creates an instance of a
FaultToleranceConfig bound to the given InvocationContext and
Stereotypes lookup. |
FaultToleranceMetrics |
getMetrics(javax.interceptor.InvocationContext context)
Creates an instance of
FaultToleranceMetrics bound to the given InvocationContext . |
CircuitBreakerState |
getState(int requestVolumeThreshold,
javax.interceptor.InvocationContext context) |
BulkheadSemaphore |
getWaitingQueuePopulation(int queueCapacity,
javax.interceptor.InvocationContext context) |
void |
runAsynchronous(CompletableFuture<Object> asyncResult,
javax.interceptor.InvocationContext context,
Callable<Object> task)
Runs the task asynchronously and completes the given asyncResult with the its outcome.
|
Future<?> |
runDelayed(long delayMillis,
Runnable task)
Runs a given task after a certain waiting time.
|
void |
trace(String method,
javax.interceptor.InvocationContext context)
Starts tracing the given context named with the given method label.
|
FaultToleranceConfig getConfig(javax.interceptor.InvocationContext context, Stereotypes stereotypes)
FaultToleranceConfig
bound to the given InvocationContext
and
Stereotypes
lookup.context
- currently processed contextstereotypes
- way to lookup sterotype annotationsFaultToleranceConfig
instance bound to the given contextFaultToleranceMetrics getMetrics(javax.interceptor.InvocationContext context)
FaultToleranceMetrics
bound to the given InvocationContext
.context
- currently processed contextFaultToleranceMetrics
instance bound to the given contextCircuitBreakerState getState(int requestVolumeThreshold, javax.interceptor.InvocationContext context)
BulkheadSemaphore getConcurrentExecutions(int maxConcurrentThreads, javax.interceptor.InvocationContext context)
BulkheadSemaphore getWaitingQueuePopulation(int queueCapacity, javax.interceptor.InvocationContext context)
void delay(long delayMillis, javax.interceptor.InvocationContext context) throws InterruptedException
delayMillis
- the time to sleep in millisecondscontext
- current context delayedInterruptedException
- In case waiting is interruptedFuture<?> runDelayed(long delayMillis, Runnable task) throws Exception
delayMillis
- time to wait in milliseconds before running the given tasktask
- operation to runException
void runAsynchronous(CompletableFuture<Object> asyncResult, javax.interceptor.InvocationContext context, Callable<Object> task) throws RejectedExecutionException
asyncResult
- a not yet completed CompletableFuture
that should receive the result of the operation
when it is executedcontext
- the currently processed context (for e.g. tracing)task
- an operation that must compute a value of type Future
or CompletionStage
.RejectedExecutionException
- In case the task could not be accepted for execution. Usually due to too many
work in progress.Object fallbackHandle(Class<? extends org.eclipse.microprofile.faulttolerance.FallbackHandler<?>> fallbackClass, javax.interceptor.InvocationContext context, Exception ex) throws Exception
FallbackHandler
Class
defined in the given context to handle
the given Exception
.fallbackClass
- the type of FallbackHandler
to resolve or instantiate and usecontext
- the currently processed context to use for argumentsex
- the Exception
thrown by the FT processing to handle by the FallbackHandler
FallbackHandler
Exception
- in case resolving, instantiating or invoking the handler method failsObject fallbackInvoke(Method fallbackMethod, javax.interceptor.InvocationContext context) throws Exception
Method
in the given context.void trace(String method, javax.interceptor.InvocationContext context)
method
- the label to use for the tracecontext
- the currently processed contextvoid endTrace()
Copyright © 2019. All rights reserved.