public class CloseableExecutorService extends Object implements Closeable
| Modifier and Type | Class and Description |
|---|---|
protected class |
CloseableExecutorService.InternalFutureTask<T> |
protected class |
CloseableExecutorService.InternalScheduledFutureTask |
| Modifier and Type | Field and Description |
|---|---|
protected AtomicBoolean |
isOpen |
| Constructor and Description |
|---|
CloseableExecutorService(ExecutorService executorService) |
CloseableExecutorService(ExecutorService executorService,
boolean shutdownOnClose) |
| Modifier and Type | Method and Description |
|---|---|
void |
close()
Closes any tasks currently in progress
|
boolean |
isShutdown()
Returns true if this executor has been shut down.
|
<V> Future<V> |
submit(Callable<V> task)
Submits a value-returning task for execution and returns a Future
representing the pending results of the task.
|
Future<?> |
submit(Runnable task)
Submits a Runnable task for execution and returns a Future
representing that task.
|
protected final AtomicBoolean isOpen
public CloseableExecutorService(ExecutorService executorService)
executorService - the service to decoratepublic CloseableExecutorService(ExecutorService executorService, boolean shutdownOnClose)
executorService - the service to decorateshutdownOnClose - if true, shutdown the executor service when this is closedpublic boolean isShutdown()
public void close()
close in interface Closeableclose in interface AutoCloseablepublic <V> Future<V> submit(Callable<V> task)
task - the task to submitCopyright © 2011–2018 The Apache Software Foundation. All rights reserved.