ExecutorService as a CloseableExecutorService and avoids calling its shutdown
methods when the wrapper is shut down
| Modifier and Type | Field and Description |
|---|---|
| protected final CloseFuture | |
| protected final ExecutorService |
| Access | Constructor and Description |
|---|---|
| public |
| Modifier and Type | Method and Description |
|---|---|
| public void | addCloseFutureListener(SshFutureListener<CloseFuture>
The notification listener)SshFutureListener - never nullImplements org. Pre-register a listener to be informed when resource is closed. |
| public boolean | awaitTermination(long
the maximum time to wait timeout, TimeUnit the time unit of the timeout argument unit)Implements java. Blocks until all tasks have completed execution after a shutdown request, or the timeout occurs, or the current thread is interrupted, whichever happens first. |
| public CloseFuture | close(boolean
true if the resource should be shut down abruptly, false for a
graceful closeImplements org. Close this resource asynchronously and return a future. |
| public void | execute(Runnable
the runnable task command)Implements java. Executes the given command at some time in the future. |
| public <T> List | invokeAll(Collection<? extends Callable<T>>
the collection of tasks tasks)Implements java. Executes the given tasks, returning a list of Futures holding their status and results when all complete. |
| public <T> List | invokeAll(Collection<? extends Callable<T>>
the collection of tasks tasks, long the maximum time to wait timeout, TimeUnit the time unit of the timeout argument unit)Implements java. Executes the given tasks, returning a list of Futures holding their status and results when all complete or the timeout expires, whichever happens first. |
| public <T> T | invokeAny(Collection<? extends Callable<T>>
the collection of tasks tasks)Implements java. Executes the given tasks, returning the result of one that has completed successfully (i.e., without throwing an exception), if any do. |
| public <T> T | invokeAny(Collection<? extends Callable<T>>
the collection of tasks tasks, long the maximum time to wait timeout, TimeUnit the time unit of the timeout argument unit)Implements java. Executes the given tasks, returning the result of one that has completed successfully (i.e., without throwing an exception), if any do before the given timeout elapses. |
| public boolean | isClosed()
Implements org. Returns |
| public boolean | isClosing()
Implements org. Returns |
| public boolean | isShutdown()
Implements java. Returns |
| public boolean | isTerminated()
Implements java. Returns |
| public void | removeCloseFutureListener(SshFutureListener<CloseFuture>
The register listener)SshFutureListener - never null. Ignored if not registered or
resource already closedImplements org. Remove a pre-registered close event listener |
| public void | shutdown()
Implements java. Initiates an orderly shutdown in which previously submitted tasks are executed, but no new tasks will be accepted. |
| public List | shutdownNow()
Implements java. Attempts to stop all actively executing tasks, halts the processing of waiting tasks, and returns a list of the tasks that were awaiting execution. |
| public <T> Future | submit(Callable<T>
the task to submit task)Implements java. Submits a value-returning task for execution and returns a Future representing the pending results of the task. |
| public <T> Future | submit(Runnable
the task to submit task, T the result to return result)Implements java. Submits a Runnable task for execution and returns a Future representing that task. |
| public Future | submit(Runnable
the task to submit task)Implements java. Submits a Runnable task for execution and returns a Future representing that task. |
| closeFuture | back to summary |
|---|---|
| protected final CloseFuture closeFuture | |
| executor | back to summary |
|---|---|
| protected final ExecutorService executor | |
| NoCloseExecutor | back to summary |
|---|---|
| public NoCloseExecutor(ExecutorService executor) | |
| addCloseFutureListener | back to summary |
|---|---|
| public void addCloseFutureListener(SshFutureListener<CloseFuture> listener) Implements org. Doc from org. Pre-register a listener to be informed when resource is closed. If resource is already closed, the listener will be invoked immediately and not registered for future notification
| |
| awaitTermination | back to summary |
|---|---|
| public boolean awaitTermination(long timeout, TimeUnit unit) throws InterruptedException Implements java. Doc from java. Blocks until all tasks have completed execution after a shutdown request, or the timeout occurs, or the current thread is interrupted, whichever happens first.
| |
| close | back to summary |
|---|---|
| public CloseFuture close(boolean immediately) Implements org. Doc from org. Close this resource asynchronously and return a future. Resources support two closing modes: a graceful mode which will cleanly close the resource and an immediate mode which will close the resources abruptly.
| |
| execute | back to summary |
|---|---|
| public void execute(Runnable command) Implements java. Doc from java. Executes the given command at some time in the future. The command
may execute in a new thread, in a pooled thread, or in the calling
thread, at the discretion of the | |
| invokeAll | back to summary |
|---|---|
| public <T> List Implements java. Doc from java. Executes the given tasks, returning a list of Futures holding
their status and results when all complete.
| |
| invokeAll | back to summary |
|---|---|
| public <T> List Implements java. Doc from java. Executes the given tasks, returning a list of Futures holding
their status and results
when all complete or the timeout expires, whichever happens first.
| |
| invokeAny | back to summary |
|---|---|
| public <T> T invokeAny(Collection<? extends Callable<T>> tasks) throws InterruptedException, ExecutionException Implements java. Doc from java. Executes the given tasks, returning the result of one that has completed successfully (i.e., without throwing an exception), if any do. Upon normal or exceptional return, tasks that have not completed are cancelled. The results of this method are undefined if the given collection is modified while this operation is in progress.
| |
| invokeAny | back to summary |
|---|---|
| public <T> T invokeAny(Collection<? extends Callable<T>> tasks, long timeout, TimeUnit unit) throws InterruptedException, ExecutionException, TimeoutException Implements java. Doc from java. Executes the given tasks, returning the result of one that has completed successfully (i.e., without throwing an exception), if any do before the given timeout elapses. Upon normal or exceptional return, tasks that have not completed are cancelled. The results of this method are undefined if the given collection is modified while this operation is in progress.
| |
| isClosed | back to summary |
|---|---|
| public boolean isClosed() Implements org. Doc from org. Returns
| |
| isClosing | back to summary |
|---|---|
| public boolean isClosing() Implements org. Doc from org. Returns
| |
| isShutdown | back to summary |
|---|---|
| public boolean isShutdown() Implements java. Doc from java. Returns
| |
| isTerminated | back to summary |
|---|---|
| public boolean isTerminated() Implements java. Doc from java. Returns
| |
| removeCloseFutureListener | back to summary |
|---|---|
| public void removeCloseFutureListener(SshFutureListener<CloseFuture> listener) Implements org. Doc from org. Remove a pre-registered close event listener
| |
| shutdown | back to summary |
|---|---|
| public void shutdown() Implements java. Doc from java. Initiates an orderly shutdown in which previously submitted tasks are executed, but no new tasks will be accepted. Invocation has no additional effect if already shut down. This method does not wait for previously submitted tasks to
complete execution. Use
| |
| shutdownNow | back to summary |
|---|---|
| public List Implements java. Doc from java. Attempts to stop all actively executing tasks, halts the processing of waiting tasks, and returns a list of the tasks that were awaiting execution. This method does not wait for actively executing tasks to
terminate. Use There are no guarantees beyond best-effort attempts to stop
processing actively executing tasks. For example, typical
implementations will cancel via | |
| submit | back to summary |
|---|---|
| public <T> Future Implements java. Doc from java. Submits a value-returning task for execution and returns a
Future representing the pending results of the task. The
Future's
If you would like to immediately block waiting
for a task, you can use constructions of the form
Note The | |
| submit | back to summary |
|---|---|
| public <T> Future Implements java. Doc from java. Submits a Runnable task for execution and returns a Future
representing that task. The Future's | |
| submit | back to summary |
|---|---|
| public Future Implements java. Doc from java. Submits a Runnable task for execution and returns a Future
representing that task. The Future's | |