@ContractsProvided(value=FaultToleranceService.class) @Service(name="microprofile-fault-tolerance-service") @RunLevel(value=10) public class FaultToleranceServiceImpl extends Object implements EventListener, FaultToleranceService, MonitoringDataSource
EventListener.Event<T>| Constructor and Description |
|---|
FaultToleranceServiceImpl() |
| Modifier and Type | Method and Description |
|---|---|
void |
collect(MonitoringDataCollector collector)
Collects all the data points of this at the current moment.
|
void |
delay(long delayMillis,
javax.interceptor.InvocationContext context)
Delays the current thread by the given duration.
|
void |
endTrace()
Ends the innermost trace.
|
void |
event(EventListener.Event<?> event)
Process a Glassfish/Payara event
|
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 |
postConstruct() |
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.
|
@PostConstruct public void postConstruct() throws NamingException
NamingExceptionpublic void event(EventListener.Event<?> event)
EventListenerevent in interface EventListenerpublic void collect(MonitoringDataCollector collector)
MonitoringDataSourcecollect in interface MonitoringDataSourcecollector - the MonitoringDataCollector instance to use to collect the data points of this sourcepublic FaultToleranceConfig getConfig(javax.interceptor.InvocationContext context, Stereotypes stereotypes)
FaultToleranceServiceFaultToleranceConfig bound to the given InvocationContext and
Stereotypes lookup.getConfig in interface FaultToleranceServicecontext - currently processed contextstereotypes - way to lookup sterotype annotationsFaultToleranceConfig instance bound to the given contextpublic FaultToleranceMetrics getMetrics(javax.interceptor.InvocationContext context)
FaultToleranceServiceFaultToleranceMetrics bound to the given InvocationContext.getMetrics in interface FaultToleranceServicecontext - currently processed contextFaultToleranceMetrics instance bound to the given contextpublic CircuitBreakerState getState(int requestVolumeThreshold, javax.interceptor.InvocationContext context)
getState in interface FaultToleranceServicepublic BulkheadSemaphore getConcurrentExecutions(int maxConcurrentThreads, javax.interceptor.InvocationContext context)
getConcurrentExecutions in interface FaultToleranceServicepublic BulkheadSemaphore getWaitingQueuePopulation(int queueCapacity, javax.interceptor.InvocationContext context)
getWaitingQueuePopulation in interface FaultToleranceServicepublic void delay(long delayMillis,
javax.interceptor.InvocationContext context)
throws InterruptedException
FaultToleranceServicedelay in interface FaultToleranceServicedelayMillis - the time to sleep in millisecondscontext - current context delayedInterruptedException - In case waiting is interruptedpublic void runAsynchronous(CompletableFuture<Object> asyncResult, javax.interceptor.InvocationContext context, Callable<Object> task) throws RejectedExecutionException
FaultToleranceServicerunAsynchronous in interface FaultToleranceServiceasyncResult - 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.public Future<?> runDelayed(long delayMillis, Runnable task) throws Exception
FaultToleranceServicerunDelayed in interface FaultToleranceServicedelayMillis - time to wait in milliseconds before running the given tasktask - operation to runExceptionpublic Object fallbackHandle(Class<? extends org.eclipse.microprofile.faulttolerance.FallbackHandler<?>> fallbackClass, javax.interceptor.InvocationContext context, Exception ex) throws Exception
FaultToleranceServiceFallbackHandler Class defined in the given context to handle
the given Exception.fallbackHandle in interface FaultToleranceServicefallbackClass - 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 failspublic Object fallbackInvoke(Method fallbackMethod, javax.interceptor.InvocationContext context) throws Exception
FaultToleranceServiceMethod in the given context.fallbackInvoke in interface FaultToleranceServicefallbackMethod - the Method to invokecontext - the currently processed context to use for target instance and method argumentsException - in case invoking the method fails or the invoked method threw an Exceptionpublic void trace(String method, javax.interceptor.InvocationContext context)
FaultToleranceServicetrace in interface FaultToleranceServicemethod - the label to use for the tracecontext - the currently processed contextpublic void endTrace()
FaultToleranceServiceendTrace in interface FaultToleranceServiceCopyright © 2019. All rights reserved.