com.google.common.util.concurrent

## Class AbstractListeningExecutorService

- java.lang.Object
- - java.util.concurrent.AbstractExecutorService
  - - com.google.common.util.concurrent.AbstractListeningExecutorService

- All Implemented Interfaces:
    ListeningExecutorService, java.util.concurrent.Executor, java.util.concurrent.ExecutorService

      @Beta
      public abstract class AbstractListeningExecutorService
      extends java.util.concurrent.AbstractExecutorService
      implements ListeningExecutorService

  Abstract `ListeningExecutorService` implementation that creates `ListenableFuture` instances for each `Runnable` and `Callable` submitted to it. These tasks are run with the abstract `execute(Runnable)` method.

  In addition to `Executor.execute(java.lang.Runnable)`, subclasses must implement all methods related to shutdown and termination.

  Since:
    14.0

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `AbstractListeningExecutorService()`

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `protected <T> java.util.concurrent.RunnableFuture<T>` | `newTaskFor(java.util.concurrent.Callable<T> callable)`
    `protected <T> java.util.concurrent.RunnableFuture<T>` | `newTaskFor(java.lang.Runnable runnable, T value)`
    `<T> ListenableFuture<T>` | `submit(java.util.concurrent.Callable<T> task)`
    `ListenableFuture<?>` | `submit(java.lang.Runnable task)`
    `<T> ListenableFuture<T>` | `submit(java.lang.Runnable task, T result)`

    - ### 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 com.google.common.util.concurrent.ListeningExecutorService

      `invokeAll, invokeAll`

    - ### Methods inherited from interface java.util.concurrent.ExecutorService

      `awaitTermination, invokeAny, invokeAny, isShutdown, isTerminated, shutdown, shutdownNow`

    - ### Methods inherited from interface java.util.concurrent.Executor

      `execute`

- - ### Constructor Detail

    - #### AbstractListeningExecutorService

          public AbstractListeningExecutorService()

  - ### Method Detail

    - #### newTaskFor

          protected final <T> java.util.concurrent.RunnableFuture<T> newTaskFor(java.lang.Runnable runnable,
                                                              T value)

      Overrides:
        `newTaskFor` in class `java.util.concurrent.AbstractExecutorService`
      Since:
        19.0 (present with return type `ListenableFutureTask` since 14.0)

    - #### newTaskFor

          protected final <T> java.util.concurrent.RunnableFuture<T> newTaskFor(java.util.concurrent.Callable<T> callable)

      Overrides:
        `newTaskFor` in class `java.util.concurrent.AbstractExecutorService`
      Since:
        19.0 (present with return type `ListenableFutureTask` since 14.0)

    - #### submit

          public ListenableFuture<?> submit(java.lang.Runnable task)

      Specified by:
        `submit` in interface `ListeningExecutorService`
      Specified by:
        `submit` in interface `java.util.concurrent.ExecutorService`
      Overrides:
        `submit` in class `java.util.concurrent.AbstractExecutorService`
      Returns:
        a `ListenableFuture` representing pending completion of the task

    - #### submit

          public <T> ListenableFuture<T> submit(java.lang.Runnable task,
                                       @Nullable
                                       T result)

      Specified by:
        `submit` in interface `ListeningExecutorService`
      Specified by:
        `submit` in interface `java.util.concurrent.ExecutorService`
      Overrides:
        `submit` in class `java.util.concurrent.AbstractExecutorService`
      Returns:
        a `ListenableFuture` representing pending completion of the task

    - #### submit

          public <T> ListenableFuture<T> submit(java.util.concurrent.Callable<T> task)

      Specified by:
        `submit` in interface `ListeningExecutorService`
      Specified by:
        `submit` in interface `java.util.concurrent.ExecutorService`
      Overrides:
        `submit` in class `java.util.concurrent.AbstractExecutorService`
      Returns:
        a `ListenableFuture` representing pending completion of the task