org.apache.curator.utils
Class CloseableExecutorService
java.lang.Object
org.apache.curator.utils.CloseableExecutorService
- All Implemented Interfaces:
- Closeable
- Direct Known Subclasses:
- CloseableScheduledExecutorService
public class CloseableExecutorService
- extends Object
- implements Closeable
Decoration on an ExecutorService that tracks created futures and provides
a method to close futures created via this class
|
Method Summary |
void |
close()
Closes any tasks currently in progress |
boolean |
isShutdown()
Returns true if this executor has been shut down. |
|
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. |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
isOpen
protected final AtomicBoolean isOpen
CloseableExecutorService
public CloseableExecutorService(ExecutorService executorService)
- Parameters:
executorService - the service to decorate
CloseableExecutorService
public CloseableExecutorService(ExecutorService executorService,
boolean shutdownOnClose)
- Parameters:
executorService - the service to decorateshutdownOnClose - if true, shutdown the executor service when this is closed
isShutdown
public boolean isShutdown()
- Returns true if this executor has been shut down.
- Returns:
- true if this executor has been shut down
close
public void close()
- Closes any tasks currently in progress
- Specified by:
close in interface Closeable
submit
public <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. Upon completion,
this task may be taken or polled.
- Parameters:
task - the task to submit
- Returns:
- a future to watch the task
submit
public Future<?> submit(Runnable task)
- Submits a Runnable task for execution and returns a Future
representing that task. Upon completion, this task may be
taken or polled.
- Parameters:
task - the task to submit
- Returns:
- a future to watch the task
Copyright © 2011–2014 The Apache Software Foundation. All rights reserved.