|
||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||
java.lang.Objectjconch.testing.SerialExecutorService
public class SerialExecutorService
This ExecutorService never spawns any new threads, it always executes everything it can immedietely. This Executor is not capable of being interrupted. This class is meant to be useful in unit tests.
| Constructor Summary | |
|---|---|
SerialExecutorService()
|
|
| Method Summary | ||
|---|---|---|
boolean |
awaitTermination(long timeout,
TimeUnit unit)
Returns immedietly. |
|
void |
execute(Runnable task)
Executes the runnable immedietly on the current thread. |
|
|
invokeAll(Collection<? extends Callable<T>> tasks)
Executes all the tasks on the current thread immedietly. |
|
|
invokeAll(Collection<? extends Callable<T>> tasks,
long timeout,
TimeUnit unit)
Executes all the tasks on the current thread immedietly. |
|
|
invokeAny(Collection<? extends Callable<T>> tasks)
Executes the tasks immedietly on the current thread, returning the first result available that didn't result in an exception. |
|
|
invokeAny(Collection<? extends Callable<T>> tasks,
long timeout,
TimeUnit unit)
Executes the tasks immedietly on the current thread, returning the first result available that didn't result in an exception. |
|
boolean |
isShutdown()
|
|
boolean |
isTerminated()
|
|
void |
shutdown()
|
|
List<Runnable> |
shutdownNow()
Marks the executor as shutdown, and now more tasks are accepted for execution. |
|
|
submit(Callable<T> task)
Executes the task immedietly on the current thread. |
|
Future<?> |
submit(Runnable task)
Executes the task immedietly on the current thread. |
|
|
submit(Runnable task,
T result)
Executes the task immedietly on the current thread, returning the result passed in. |
|
| 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 |
| Constructor Detail |
|---|
public SerialExecutorService()
| Method Detail |
|---|
public void shutdown()
shutdown in interface ExecutorServicepublic List<Runnable> shutdownNow()
shutdownNow in interface ExecutorServicepublic boolean isShutdown()
isShutdown in interface ExecutorServicepublic boolean isTerminated()
isTerminated in interface ExecutorService
public boolean awaitTermination(long timeout,
TimeUnit unit)
awaitTermination in interface ExecutorServicetimeout - ignoredunit - ignored
public <T> Future<T> submit(Callable<T> task)
submit in interface ExecutorServicetask - task to execute, may not be null
RuntimeException - if task execution failed
public <T> Future<T> submit(Runnable task,
T result)
submit in interface ExecutorServicetask - task to execute, may not be nullresult - result to return in the future, may be null
public Future<?> submit(Runnable task)
submit in interface ExecutorServicetask - task to execute
public <T> List<Future<T>> invokeAll(Collection<? extends Callable<T>> tasks)
throws InterruptedException
tasks - tasks to execute
InterruptedException
public <T> List<Future<T>> invokeAll(Collection<? extends Callable<T>> tasks,
long timeout,
TimeUnit unit)
tasks - tasks to executetimeout - timeout lengthunit - timeout time unit
public <T> T invokeAny(Collection<? extends Callable<T>> tasks)
throws InterruptedException,
ExecutionException
tasks - tasks to execute, some of which will not get executed
ExecutionException - if no task ended successfully
InterruptedException
public <T> T invokeAny(Collection<? extends Callable<T>> tasks,
long timeout,
TimeUnit unit)
throws ExecutionException,
TimeoutException
tasks - tasks to execute, some of which will not get executedtimeout - timeout lengthunit - timeout time unit
ExecutionException - if no task ended successfully
TimeoutException - if timeout occurspublic void execute(Runnable task)
execute in interface Executortask - task to execute
|
||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||