@CanIgnoreReturnValue @GwtIncompatible public abstract class ForwardingListeningExecutorService extends ForwardingExecutorService implements ListeningExecutorService
Modifier | Constructor and Description |
---|---|
protected |
ForwardingListeningExecutorService()
Constructor for use by subclasses.
|
Modifier and Type | Method and Description |
---|---|
protected abstract ListeningExecutorService |
delegate()
Returns the backing delegate instance that methods are forwarded to.
|
<T> ListenableFuture<T> |
submit(Callable<T> task)
Submits a value-returning task for execution and returns a
Future representing the pending results of the task.
|
ListenableFuture<?> |
submit(Runnable task)
Submits a Runnable task for execution and returns a Future
representing that task.
|
<T> ListenableFuture<T> |
submit(Runnable task,
T result)
Submits a Runnable task for execution and returns a Future
representing that task.
|
awaitTermination, execute, invokeAll, invokeAll, invokeAny, invokeAny, isShutdown, isTerminated, shutdown, shutdownNow
toString
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
invokeAll, invokeAll
awaitTermination, invokeAny, invokeAny, isShutdown, isTerminated, shutdown, shutdownNow
protected ForwardingListeningExecutorService()
protected abstract ListeningExecutorService delegate()
ForwardingObject
ForwardingSet.delegate()
. Concrete subclasses override this method to supply the
instance being decorated.delegate
in class ForwardingExecutorService
public <T> ListenableFuture<T> submit(Callable<T> task)
java.util.concurrent.ExecutorService
get
method will return the task's result upon
successful completion.
If you would like to immediately block waiting
for a task, you can use constructions of the form
result = exec.submit(aCallable).get();
Note: The Executors
class includes a set of methods
that can convert some other common closure-like objects,
for example, PrivilegedAction
to
Callable
form so they can be submitted.
submit
in interface ListeningExecutorService
submit
in interface ExecutorService
submit
in class ForwardingExecutorService
T
- the type of the task's resulttask
- the task to submitpublic ListenableFuture<?> submit(Runnable task)
java.util.concurrent.ExecutorService
get
method will
return null
upon successful completion.submit
in interface ListeningExecutorService
submit
in interface ExecutorService
submit
in class ForwardingExecutorService
task
- the task to submitpublic <T> ListenableFuture<T> submit(Runnable task, T result)
java.util.concurrent.ExecutorService
get
method will
return the given result upon successful completion.submit
in interface ListeningExecutorService
submit
in interface ExecutorService
submit
in class ForwardingExecutorService
T
- the type of the resulttask
- the task to submitresult
- the result to returnCopyright © 2010–2018. All rights reserved.