public class SerialExecutorService extends AbstractExecutorService
Modifier and Type | Field and Description |
---|---|
protected ThreadLocal<Boolean> |
draining |
protected Runnable |
drainTask |
protected ConcurrentLinkedQueue<Runnable> |
externalQueue |
protected String |
label |
protected LinkedList<Runnable> |
localQueue |
protected AtomicBoolean |
shutdown |
protected Executor |
target |
protected AtomicBoolean |
terminated |
protected CountDownLatch |
terminatedLatch |
protected AtomicBoolean |
triggered |
Constructor and Description |
---|
SerialExecutorService() |
SerialExecutorService(Executor target) |
SerialExecutorService(Executor target,
String label) |
SerialExecutorService(String label) |
Modifier and Type | Method and Description |
---|---|
boolean |
awaitTermination(long timeout,
TimeUnit unit) |
void |
drain()
This method blocks until all previously queued Runnable objects are run.
|
void |
execute(Runnable runnable)
Queues the runnable for execution.
|
void |
executeAndDrain(Runnable runnable)
Executes the runnable.
|
String |
getLabel() |
Executor |
getTarget() |
boolean |
isDraining() |
boolean |
isShutdown() |
boolean |
isTerminated() |
void |
setLabel(String label) |
void |
setTarget(Executor target) |
void |
shutdown() |
List<Runnable> |
shutdownNow() |
String |
toString() |
protected void |
triggerDrain() |
invokeAll, invokeAll, invokeAny, invokeAny, newTaskFor, newTaskFor, submit, submit, submit
protected Executor target
protected volatile String label
protected AtomicBoolean shutdown
protected AtomicBoolean terminated
protected CountDownLatch terminatedLatch
protected final AtomicBoolean triggered
protected final ConcurrentLinkedQueue<Runnable> externalQueue
protected final LinkedList<Runnable> localQueue
protected final ThreadLocal<Boolean> draining
protected final Runnable drainTask
public SerialExecutorService()
public SerialExecutorService(String label)
public SerialExecutorService(Executor target)
public void execute(Runnable runnable)
runnable
- public void executeAndDrain(Runnable runnable)
runnable
- protected void triggerDrain()
public void drain()
public void shutdown()
public boolean isDraining()
public boolean isShutdown()
public boolean isTerminated()
public boolean awaitTermination(long timeout, TimeUnit unit) throws InterruptedException
InterruptedException
public Executor getTarget()
public void setTarget(Executor target)
public String getLabel()
public void setLabel(String label)
Copyright © 2011–2016 Red Hat. All rights reserved.