Constructor and Description |
---|
SynchronousExecutors(ScheduledExecutorService pool) |
Modifier and Type | Method and Description |
---|---|
<T> ExecutorService |
newSerialExecutor(BlockingQueue<Callable<T>> queue)
The ExecutorService returned, supports a subset of ExecutorService
methods, the intent of this executor is to serialize the execution
of tasks, it is up to the BlockingQueue or caller to ensure order, only
one task will execute at a time, that task will be retried if it fails,
using a back off strategy of 1, 5 and 10 seconds, followed by 1, 1 and 5
minutes thereafter forever, no other task will execute until the task
at the head of the queue is completed successfully.
|
void |
shutdown() |
void |
start()
Called after construction, this method enables objects to delay
starting threads or exporting until after construction is complete,
to allow safe publication of the service in accordance with the JMM.
|
public SynchronousExecutors(ScheduledExecutorService pool)
public void start() throws Exception
Startable
In addition to starting threads after construction, it also allows objects to avoid throwing an exception during construction to avoid finalizer attacks.
The implementation is required to ensure start() is idempotent (only executed once, additional invocations must return immediately).
public void shutdown()
public <T> ExecutorService newSerialExecutor(BlockingQueue<Callable<T>> queue)
T
- queue
- Copyright © 2016–2018. All rights reserved.