Class CloseableTaskPoolSubmitter
java.lang.Object
org.apache.hadoop.util.functional.CloseableTaskPoolSubmitter
- All Implemented Interfaces:
Closeable,AutoCloseable,org.apache.hadoop.util.functional.TaskPool.Submitter
@Public
@Unstable
public class CloseableTaskPoolSubmitter
extends Object
implements org.apache.hadoop.util.functional.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 -
Method Summary
-
Constructor Details
-
CloseableTaskPoolSubmitter
Constructor.- Parameters:
pool- non-null executor.
-
-
Method Details
-
getPool
Get the pool.- Returns:
- the pool.
-
close
public void close()Shut down the pool.- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceCloseable
-
submit
Description copied from interface:org.apache.hadoop.util.functional.TaskPool.SubmitterSubmit work.- Specified by:
submitin interfaceorg.apache.hadoop.util.functional.TaskPool.Submitter- Parameters:
task- task to execute- Returns:
- the future of the submitted task.
-