CloseableTaskPoolSubmitter (Apache Hadoop Common 3.5.0 API)
Description: declaration: package: org.apache.hadoop.util.functional, class: CloseableTaskPoolSubmitter

Package org.apache.hadoop.util.functional

# Class CloseableTaskPoolSubmitter

java.lang.Object
org.apache.hadoop.util.functional.CloseableTaskPoolSubmitter

All Implemented Interfaces:
  `Closeable`, `AutoCloseable`, `TaskPool.Submitter`

@Public @Unstable public class CloseableTaskPoolSubmitter extends Object implements TaskPool.Submitter, Closeable
A task submitter which is closeable, and whose close() call shuts down the pool. This can help manage thread pool lifecycles.

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `CloseableTaskPoolSubmitter(ExecutorService pool)`
  Constructor.

- ## Method Summary

  Modifier and Type
  Method
  Description
  `void`
  `close()`
  Shut down the pool.
  `ExecutorService`
  `getPool()`
  Get the pool.
  `Future<?>`
  `submit(Runnable task)`
  Submit work.

  ### Methods inherited from class java.lang.Object

  `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- ## Constructor Details

  - ### CloseableTaskPoolSubmitter

    public CloseableTaskPoolSubmitter(ExecutorService pool)
    Constructor.
    Parameters:
      `pool` - non-null executor.

- ## Method Details

  - ### getPool

    public ExecutorService getPool()
    Get the pool.
    Returns:
      the pool.

  - ### close

    public void close()
    Shut down the pool.
    Specified by:
      `close` in interface `AutoCloseable`
    Specified by:
      `close` in interface `Closeable`

  - ### submit

    public Future<?> submit(Runnable task)
    Description copied from interface: `TaskPool.Submitter`
    Submit work.
    Specified by:
      `submit` in interface `TaskPool.Submitter`
    Parameters:
      `task` - task to execute
    Returns:
      the future of the submitted task.