public class DefaultRunService extends AbstractService implements RunService
actionMetrics, circuitBreaker, isShutdown, semaphoreMAX_CONCURRENCY_LEVEL, MAX_TIMEOUT_MILLIS| Constructor and Description |
|---|
DefaultRunService(PrecipiceSemaphore semaphore) |
DefaultRunService(PrecipiceSemaphore semaphore,
ActionMetrics actionMetrics) |
DefaultRunService(PrecipiceSemaphore semaphore,
ActionMetrics actionMetrics,
CircuitBreaker circuitBreaker) |
DefaultRunService(PrecipiceSemaphore semaphore,
ActionMetrics actionMetrics,
CircuitBreaker circuitBreaker,
java.util.concurrent.atomic.AtomicBoolean isShutdown) |
DefaultRunService(PrecipiceSemaphore semaphore,
CircuitBreaker breaker) |
| Modifier and Type | Method and Description |
|---|---|
<T> T |
run(ResilientAction<T> action)
Performs a
ResilientAction that will be run synchronously on the calling
thread. |
void |
shutdown()
Attempts to shutdown the service.
|
acquirePermitOrRejectIfActionNotAllowed, getActionMetrics, getCircuitBreakerclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitgetActionMetrics, getCircuitBreakerpublic DefaultRunService(PrecipiceSemaphore semaphore)
public DefaultRunService(PrecipiceSemaphore semaphore, ActionMetrics actionMetrics)
public DefaultRunService(PrecipiceSemaphore semaphore, CircuitBreaker breaker)
public DefaultRunService(PrecipiceSemaphore semaphore, ActionMetrics actionMetrics, CircuitBreaker circuitBreaker)
public DefaultRunService(PrecipiceSemaphore semaphore, ActionMetrics actionMetrics, CircuitBreaker circuitBreaker, java.util.concurrent.atomic.AtomicBoolean isShutdown)
public <T> T run(ResilientAction<T> action) throws java.lang.Exception
RunServiceResilientAction that will be run synchronously on the calling
thread. However, at the completion of the task, the result will be delivered to
the promise provided. And the provided callback will be executed.
If the ResilientAction throws a ActionTimeoutException, the result of
the action will be a timeout. Any other exception and the result of the action
will be an error.run in interface RunServiceT - the type of the result of the actionaction - the action to runResilientPromise representing result of the actionRejectedActionException - if the action is rejectedjava.lang.Exceptionpublic void shutdown()
ServiceRejectedActionException. Implementations may differ on if pending
or executing actions are cancelled.Copyright © 2014 Tim Brooks. All Rights Reserved.