Class AbstractListeningExecutorService
- java.lang.Object
-
- java.util.concurrent.AbstractExecutorService
-
- com.google.common.util.concurrent.AbstractListeningExecutorService
-
- All Implemented Interfaces:
ListeningExecutorService
,Executor
,ExecutorService
@CheckReturnValue @GwtIncompatible public abstract class AbstractListeningExecutorService extends AbstractExecutorService implements ListeningExecutorService
AbstractListeningExecutorService
implementation that createsListenableFuture
instances for eachRunnable
andCallable
submitted to it. These tasks are run with the abstractexecute(Runnable)
method.In addition to
Executor.execute(java.lang.Runnable)
, subclasses must implement all methods related to shutdown and termination.- Since:
- 14.0
- Author:
- Chris Povirk
-
-
Constructor Summary
Constructors Constructor Description AbstractListeningExecutorService()
Constructor for use by subclasses.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected <T extends @Nullable Object>
RunnableFuture<T>newTaskFor(Runnable runnable, T value)
protected <T extends @Nullable Object>
RunnableFuture<T>newTaskFor(Callable<T> callable)
ListenableFuture<?>
submit(Runnable task)
<T extends @Nullable Object>
ListenableFuture<T>submit(Runnable task, T result)
<T extends @Nullable Object>
ListenableFuture<T>submit(Callable<T> task)
-
Methods inherited from class java.util.concurrent.AbstractExecutorService
invokeAll, invokeAll, invokeAny, invokeAny
-
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
awaitTermination, invokeAny, invokeAny, isShutdown, isTerminated, shutdown, shutdownNow
-
Methods inherited from interface com.google.common.util.concurrent.ListeningExecutorService
awaitTermination, invokeAll, invokeAll, invokeAll, invokeAny
-
-
-
-
Constructor Detail
-
AbstractListeningExecutorService
public AbstractListeningExecutorService()
Constructor for use by subclasses.
-
-
Method Detail
-
newTaskFor
@CanIgnoreReturnValue protected final <T extends @Nullable Object> RunnableFuture<T> newTaskFor(Runnable runnable, T value)
- Overrides:
newTaskFor
in classAbstractExecutorService
- Since:
- 19.0 (present with return type
ListenableFutureTask
since 14.0)
-
newTaskFor
@CanIgnoreReturnValue protected final <T extends @Nullable Object> RunnableFuture<T> newTaskFor(Callable<T> callable)
- Overrides:
newTaskFor
in classAbstractExecutorService
- Since:
- 19.0 (present with return type
ListenableFutureTask
since 14.0)
-
submit
@CanIgnoreReturnValue public ListenableFuture<?> submit(Runnable task)
- Specified by:
submit
in interfaceExecutorService
- Specified by:
submit
in interfaceListeningExecutorService
- Overrides:
submit
in classAbstractExecutorService
- Returns:
- a
ListenableFuture
representing pending completion of the task
-
submit
@CanIgnoreReturnValue public <T extends @Nullable Object> ListenableFuture<T> submit(Runnable task, T result)
- Specified by:
submit
in interfaceExecutorService
- Specified by:
submit
in interfaceListeningExecutorService
- Overrides:
submit
in classAbstractExecutorService
- Returns:
- a
ListenableFuture
representing pending completion of the task
-
submit
@CanIgnoreReturnValue public <T extends @Nullable Object> ListenableFuture<T> submit(Callable<T> task)
- Specified by:
submit
in interfaceExecutorService
- Specified by:
submit
in interfaceListeningExecutorService
- Overrides:
submit
in classAbstractExecutorService
- Returns:
- a
ListenableFuture
representing pending completion of the task
-
-