public class DefaultCompletionService extends AbstractService implements CompletionService
actionMetrics, circuitBreaker, isShutdown, semaphoreMAX_CONCURRENCY_LEVEL, MAX_TIMEOUT_MILLIS| Constructor and Description |
|---|
DefaultCompletionService(java.util.concurrent.ExecutorService service,
PrecipiceSemaphore semaphore) |
DefaultCompletionService(java.util.concurrent.ExecutorService service,
PrecipiceSemaphore semaphore,
ActionMetrics actionMetrics) |
DefaultCompletionService(java.util.concurrent.ExecutorService service,
PrecipiceSemaphore semaphore,
ActionMetrics actionMetrics,
CircuitBreaker circuitBreaker) |
DefaultCompletionService(java.util.concurrent.ExecutorService service,
PrecipiceSemaphore semaphore,
ActionMetrics actionMetrics,
CircuitBreaker circuitBreaker,
java.util.concurrent.atomic.AtomicBoolean isShutdown) |
DefaultCompletionService(java.util.concurrent.ExecutorService service,
PrecipiceSemaphore semaphore,
CircuitBreaker breaker) |
| Modifier and Type | Method and Description |
|---|---|
void |
shutdown()
Attempts to shutdown the service.
|
<T> void |
submitAndComplete(ResilientAction<T> action,
ResilientPromise<T> promise,
long millisTimeout)
Submits a
ResilientAction that will be run asynchronously. |
<T> void |
submitAndComplete(ResilientAction<T> action,
ResilientPromise<T> promise,
ResilientCallback<T> callback,
long millisTimeout)
Submits a
ResilientAction that will be run asynchronously. |
acquirePermitOrRejectIfActionNotAllowed, getActionMetrics, getCircuitBreakerclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitgetActionMetrics, getCircuitBreakerpublic DefaultCompletionService(java.util.concurrent.ExecutorService service,
PrecipiceSemaphore semaphore)
public DefaultCompletionService(java.util.concurrent.ExecutorService service,
PrecipiceSemaphore semaphore,
ActionMetrics actionMetrics)
public DefaultCompletionService(java.util.concurrent.ExecutorService service,
PrecipiceSemaphore semaphore,
CircuitBreaker breaker)
public DefaultCompletionService(java.util.concurrent.ExecutorService service,
PrecipiceSemaphore semaphore,
ActionMetrics actionMetrics,
CircuitBreaker circuitBreaker)
public DefaultCompletionService(java.util.concurrent.ExecutorService service,
PrecipiceSemaphore semaphore,
ActionMetrics actionMetrics,
CircuitBreaker circuitBreaker,
java.util.concurrent.atomic.AtomicBoolean isShutdown)
public <T> void submitAndComplete(ResilientAction<T> action, ResilientPromise<T> promise, long millisTimeout)
CompletionServiceResilientAction that will be run asynchronously. At the
completion of the task, the result will be delivered to the promise provided.submitAndComplete in interface CompletionServiceT - the type of the result of the actionaction - the action to submitpromise - a promise to which deliver the resultmillisTimeout - milliseconds before the action times outpublic <T> void submitAndComplete(ResilientAction<T> action, ResilientPromise<T> promise, ResilientCallback<T> callback, long millisTimeout)
CompletionServiceResilientAction that will be run asynchronously. At the completion
of the task, the result will be delivered to the promise provided. And the provided
callback will be executed.submitAndComplete in interface CompletionServiceT - the type of the result of the actionaction - the action to submitpromise - a promise to which deliver the resultcallback - to run on action completionmillisTimeout - milliseconds before the action times outpublic void shutdown()
ServiceRejectedActionException. Implementations may differ on if pending
or executing actions are cancelled.Copyright © 2014 Tim Brooks. All Rights Reserved.