|
JBoss Threads 2.0.0.GA-redhat-2 | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectjava.util.concurrent.AbstractExecutorService
org.jboss.threads.OrderedExecutor
public final class OrderedExecutor
An executor that always runs all tasks in queue order, using a delegate executor to run the tasks.
More specifically, if a FIFO queue type is used, any call B to theexecute(Runnable)
method that
happens-after another call A to the same method, will result in B's task running after A's.
Constructor Summary | |
---|---|
OrderedExecutor(Executor parent)
Construct a new instance using an unbounded FIFO queue. |
|
OrderedExecutor(Executor parent,
int queueLength)
Construct a new instance using a bounded FIFO queue of the given size and a blocking reject policy. |
|
OrderedExecutor(Executor parent,
int queueLength,
boolean blocking,
Executor handoffExecutor)
Construct a new instance using a bounded FIFO queue of the given size and a handoff reject policy. |
|
OrderedExecutor(Executor parent,
int queueLength,
Executor handoffExecutor)
Construct a new instance using a bounded FIFO queue of the given size and a handoff reject policy. |
|
OrderedExecutor(Executor parent,
Queue<Runnable> queue)
Construct a new instance using the given queue and a blocking reject policy. |
|
OrderedExecutor(Executor parent,
Queue<Runnable> queue,
boolean blocking,
Executor handoffExecutor)
Construct a new instance. |
Method Summary | |
---|---|
boolean |
awaitTermination(long timeout,
TimeUnit unit)
|
void |
execute(Runnable task)
Run a task. |
void |
executeBlocking(Runnable task)
Execute a task, blocking until it can be accepted, or until the calling thread is interrupted. |
void |
executeBlocking(Runnable task,
long timeout,
TimeUnit unit)
Execute a task, blocking until it can be accepted, a timeout elapses, or the calling thread is interrupted. |
void |
executeNonBlocking(Runnable task)
Execute a task, without blocking. |
boolean |
isShutdown()
|
boolean |
isTerminated()
|
void |
shutdown()
|
List<Runnable> |
shutdownNow()
|
Methods inherited from class java.util.concurrent.AbstractExecutorService |
---|
invokeAll, invokeAll, invokeAny, invokeAny, newTaskFor, newTaskFor, submit, submit, submit |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Methods inherited from interface java.util.concurrent.ExecutorService |
---|
invokeAll, invokeAll, invokeAny, invokeAny, submit, submit, submit |
Constructor Detail |
---|
public OrderedExecutor(Executor parent)
parent
- the parent to delegate tasks topublic OrderedExecutor(Executor parent, Queue<Runnable> queue)
parent
- the parent to delegate tasks toqueue
- the queue to use to hold taskspublic OrderedExecutor(Executor parent, int queueLength)
parent
- the parent to delegate tasks toqueueLength
- the fixed length of the queue to use to hold taskspublic OrderedExecutor(Executor parent, int queueLength, Executor handoffExecutor)
parent
- the parent executorqueueLength
- the fixed length of the queue to use to hold taskshandoffExecutor
- the executor to hand tasks to if the queue is fullpublic OrderedExecutor(Executor parent, Queue<Runnable> queue, boolean blocking, Executor handoffExecutor)
parent
- the parent executorqueue
- the task queue to useblocking
- true
if rejected tasks should block, false
if rejected tasks should be handed offhandoffExecutor
- the executor to hand tasks to if the queue is fullpublic OrderedExecutor(Executor parent, int queueLength, boolean blocking, Executor handoffExecutor)
parent
- the parent executorqueueLength
- the fixed length of the queue to use to hold tasksblocking
- true
if rejected tasks should block, false
if rejected tasks should be handed offhandoffExecutor
- the executor to hand tasks to if the queue is fullMethod Detail |
---|
public void execute(Runnable task)
execute
in interface Executor
execute
in interface BlockingExecutor
task
- the task to run.public void executeBlocking(Runnable task) throws RejectedExecutionException, InterruptedException
BlockingExecutor
executeBlocking
in interface BlockingExecutor
task
- the task to submit
StoppedExecutorException
- if the executor was shut down before the task was accepted
ThreadCreationException
- if a thread could not be created for some reason
RejectedExecutionException
- if execution is rejected for some other reason
InterruptedException
- if the current thread was interrupted before the task could be acceptedpublic void executeBlocking(Runnable task, long timeout, TimeUnit unit) throws RejectedExecutionException, InterruptedException
BlockingExecutor
executeBlocking
in interface BlockingExecutor
task
- the task to submittimeout
- the amount of time to waitunit
- the unit of time
ExecutionTimedOutException
- if the timeout elapsed before a task could be accepted
StoppedExecutorException
- if the executor was shut down before the task was accepted
ThreadCreationException
- if a thread could not be created for some reason
RejectedExecutionException
- if execution is rejected for some other reason
InterruptedException
- if the current thread was interrupted before the task could be acceptedpublic void executeNonBlocking(Runnable task) throws RejectedExecutionException
BlockingExecutor
executeNonBlocking
in interface BlockingExecutor
task
- the task to submit
StoppedExecutorException
- if the executor was shut down before the task was accepted
ThreadCreationException
- if a thread could not be created for some reason
RejectedExecutionException
- if execution is rejected for some other reasonpublic boolean isShutdown()
isShutdown
in interface ExecutorService
public boolean isTerminated()
isTerminated
in interface ExecutorService
public boolean awaitTermination(long timeout, TimeUnit unit) throws InterruptedException
awaitTermination
in interface ExecutorService
InterruptedException
public void shutdown()
shutdown
in interface ExecutorService
public List<Runnable> shutdownNow()
shutdownNow
in interface ExecutorService
|
JBoss Threads 2.0.0.GA-redhat-2 | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |