- java.lang.Object
-
- net.morimekta.testing.concurrent.ImmediateExecutor
-
- All Implemented Interfaces:
Executor
,ExecutorService
public class ImmediateExecutor extends Object implements ExecutorService
Fake executor service that runs all tasks immediately. If you need a fake executor that delays execution, useImmediateScheduledExecutor
, and trigger executions by ticking the clock.
-
-
Constructor Summary
Constructors Constructor Description ImmediateExecutor()
Create an immediate executor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
awaitTermination(long l, TimeUnit timeUnit)
void
execute(Runnable runnable)
<T> List<Future<T>>
invokeAll(Collection<? extends Callable<T>> collection)
<T> List<Future<T>>
invokeAll(Collection<? extends Callable<T>> collection, long l, TimeUnit timeUnit)
<T> T
invokeAny(Collection<? extends Callable<T>> collection)
<T> T
invokeAny(Collection<? extends Callable<T>> collection, long l, TimeUnit timeUnit)
boolean
isShutdown()
boolean
isTerminated()
void
shutdown()
List<Runnable>
shutdownNow()
Future<?>
submit(Runnable runnable)
<T> Future<T>
submit(Runnable runnable, T t)
<T> Future<T>
submit(Callable<T> callable)
-
-
-
Method Detail
-
shutdown
public void shutdown()
- Specified by:
shutdown
in interfaceExecutorService
-
shutdownNow
public List<Runnable> shutdownNow()
- Specified by:
shutdownNow
in interfaceExecutorService
-
isShutdown
public boolean isShutdown()
- Specified by:
isShutdown
in interfaceExecutorService
-
isTerminated
public boolean isTerminated()
- Specified by:
isTerminated
in interfaceExecutorService
-
awaitTermination
public boolean awaitTermination(long l, TimeUnit timeUnit)
- Specified by:
awaitTermination
in interfaceExecutorService
-
submit
public <T> Future<T> submit(Callable<T> callable)
- Specified by:
submit
in interfaceExecutorService
-
submit
public <T> Future<T> submit(Runnable runnable, T t)
- Specified by:
submit
in interfaceExecutorService
-
submit
public Future<?> submit(Runnable runnable)
- Specified by:
submit
in interfaceExecutorService
-
invokeAll
public <T> List<Future<T>> invokeAll(Collection<? extends Callable<T>> collection)
- Specified by:
invokeAll
in interfaceExecutorService
-
invokeAll
public <T> List<Future<T>> invokeAll(Collection<? extends Callable<T>> collection, long l, TimeUnit timeUnit)
- Specified by:
invokeAll
in interfaceExecutorService
-
invokeAny
public <T> T invokeAny(Collection<? extends Callable<T>> collection) throws ExecutionException
- Specified by:
invokeAny
in interfaceExecutorService
- Throws:
ExecutionException
-
invokeAny
public <T> T invokeAny(Collection<? extends Callable<T>> collection, long l, TimeUnit timeUnit) throws ExecutionException
- Specified by:
invokeAny
in interfaceExecutorService
- Throws:
ExecutionException
-
-