public class FakeExecutor extends Object implements ExecutorService
ExecutorService
that immediatly runs any
given runnable on the main thread. This will not use any given
threads and will never create a thread.Constructor and Description |
---|
FakeExecutor() |
Modifier and Type | Method and Description |
---|---|
boolean |
awaitTermination(long l,
TimeUnit tu) |
void |
execute(Runnable r) |
<T> List<Future<T>> |
invokeAll(Collection<? extends Callable<T>> clctn) |
<T> List<Future<T>> |
invokeAll(Collection<? extends Callable<T>> clctn,
long l,
TimeUnit tu) |
<T> T |
invokeAny(Collection<? extends Callable<T>> clctn) |
<T> T |
invokeAny(Collection<? extends Callable<T>> clctn,
long l,
TimeUnit tu) |
boolean |
isShutdown() |
boolean |
isTerminated() |
void |
shutdown() |
List<Runnable> |
shutdownNow() |
<T> Future<T> |
submit(Callable<T> clbl) |
Future<?> |
submit(Runnable r) |
<T> Future<T> |
submit(Runnable r,
T t) |
public void shutdown()
shutdown
in interface ExecutorService
public List<Runnable> shutdownNow()
shutdownNow
in interface ExecutorService
public boolean isShutdown()
isShutdown
in interface ExecutorService
public boolean isTerminated()
isTerminated
in interface ExecutorService
public boolean awaitTermination(long l, TimeUnit tu) throws InterruptedException
awaitTermination
in interface ExecutorService
InterruptedException
public <T> Future<T> submit(Callable<T> clbl)
submit
in interface ExecutorService
public <T> Future<T> submit(Runnable r, T t)
submit
in interface ExecutorService
public Future<?> submit(Runnable r)
submit
in interface ExecutorService
public <T> List<Future<T>> invokeAll(Collection<? extends Callable<T>> clctn) throws InterruptedException
invokeAll
in interface ExecutorService
InterruptedException
public <T> List<Future<T>> invokeAll(Collection<? extends Callable<T>> clctn, long l, TimeUnit tu) throws InterruptedException
invokeAll
in interface ExecutorService
InterruptedException
public <T> T invokeAny(Collection<? extends Callable<T>> clctn) throws InterruptedException, ExecutionException
invokeAny
in interface ExecutorService
InterruptedException
ExecutionException
public <T> T invokeAny(Collection<? extends Callable<T>> clctn, long l, TimeUnit tu) throws InterruptedException, ExecutionException, TimeoutException
invokeAny
in interface ExecutorService
InterruptedException
ExecutionException
TimeoutException
Copyright © 2017. All rights reserved.