public interface FaultToleranceMethodContext
| Modifier and Type | Interface and Description |
|---|---|
static class |
FaultToleranceMethodContext.AsyncFuture |
| Modifier and Type | Method and Description |
|---|---|
FaultToleranceMethodContext |
boundTo(javax.interceptor.InvocationContext context,
FaultTolerancePolicy policy) |
void |
delay(long delayMillis)
Delays the current thread by the given duration.
|
void |
endTrace()
Ends the innermost trace.
|
Object |
fallbackHandle(Class<? extends org.eclipse.microprofile.faulttolerance.FallbackHandler<?>> fallbackClass,
Throwable ex)
|
Object |
fallbackInvoke(Method fallbackMethod)
Invokes the given fallback
Method in the given context. |
BlockingQueue<Thread> |
getConcurrentExecutions()
Get or create the
BlockingQueue for bulkhead. |
FaultToleranceMetrics |
getMetrics()
Returns the
FaultToleranceMetrics to use. |
AtomicInteger |
getQueuingOrRunningPopulation()
Get the bulkhead thread count.
|
CircuitBreakerState |
getState()
Get or create the
CircuitBreakerState. |
Object |
proceed()
Proceeds execution to the annotated method body.
|
void |
runAsynchronous(FaultToleranceMethodContext.AsyncFuture asyncResult,
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)
Starts tracing the given context named with the given method label.
|
FaultToleranceMethodContext boundTo(javax.interceptor.InvocationContext context, FaultTolerancePolicy policy)
FaultToleranceMetrics getMetrics()
FaultToleranceMetrics to use.FaultToleranceMetrics to use, FaultToleranceMetrics.DISABLED when not enabled.CircuitBreakerState getState()
CircuitBreakerState.BlockingQueue<Thread> getConcurrentExecutions()
BlockingQueue for bulkhead.AtomicInteger getQueuingOrRunningPopulation()
void delay(long delayMillis)
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 runExceptionvoid runAsynchronous(FaultToleranceMethodContext.AsyncFuture asyncResult, 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, Throwable 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 FallbackHandlerFallbackHandlerException - in case resolving, instantiating or invoking the handler method failsObject fallbackInvoke(Method fallbackMethod) throws Exception
Method in the given context.void trace(String method)
method - the label to use for the tracecontext - the currently processed contextvoid endTrace()
Copyright © 2021. All rights reserved.