Client and backend. This class is shared: the same code is compiled into your app and into your server, so everything on this page works in both.
public interface ExecutorService
ExtendsExecutor
Known subtypesAbstractExecutorService, ScheduledExecutorService
An
Executor that answers a Future for a submitted task and can be
shut down. Executors creates the implementations;
AbstractExecutorService provides everything but the execution itself.Methods
Inherited methods
Method details
shutdown
public abstract void shutdown()Stops accepting tasks. The ones already submitted still run.
shutdownNow
public abstract List<Runnable> shutdownNow()Stops accepting tasks, drops the ones that have not started and
answers them, and interrupts the ones that are running.
isShutdown
public abstract boolean isShutdown()isTerminated
public abstract boolean isTerminated()Whether the service was shut down and every task it accepted has
finished or been dropped.
awaitTermination
public abstract boolean awaitTermination(long timeout, TimeUnit unit)
throws InterruptedExceptionWaits until the service has terminated or the time is up, and answers
which of the two it was.
Throws
submit
public abstract <T> Future<T> submit(Callable<T> task)submit
public abstract <T> Future<T> submit(Runnable task, T result)submit
public abstract Future<?> submit(Runnable task)invokeAll
public abstract <T> List<Future<T>> invokeAll(Collection<? extends Callable<T>> tasks)
throws InterruptedExceptionRuns every task and answers their futures, all of them done.
Throws
invokeAll
public abstract <T> List<Future<T>> invokeAll(Collection<? extends Callable<T>> tasks, long timeout, TimeUnit unit)
throws InterruptedExceptionRuns every task and answers their futures once all are done or the
time is up; the ones not done by then are cancelled.
Throws
invokeAny
public abstract <T> T invokeAny(Collection<? extends Callable<T>> tasks)
throws InterruptedException, ExecutionExceptionThe result of one of the tasks that completed without failing; the
others are cancelled.
invokeAny
public abstract <T> T invokeAny(Collection<? extends Callable<T>> tasks, long timeout, TimeUnit unit)
throws InterruptedException, ExecutionException, TimeoutExceptionAs
invokeAny(Collection), giving up with a TimeoutException when
no task has succeeded in time.