Class NoCloseExecutor
java.lang.Object
org.apache.sshd.common.util.threads.NoCloseExecutor
- All Implemented Interfaces:
Closeable,AutoCloseable,Channel,Executor,ExecutorService,Closeable,CloseableExecutorService
Wraps an
ExecutorService as a CloseableExecutorService and avoids calling its shutdown
methods when the wrapper is shut down-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidaddCloseFutureListener(SshFutureListener<CloseFuture> listener) Pre-register a listener to be informed when resource is closed.booleanawaitTermination(long timeout, TimeUnit unit) close(boolean immediately) Close this resource asynchronously and return a future.voidinvokeAll(Collection<? extends Callable<T>> tasks) invokeAll(Collection<? extends Callable<T>> tasks, long timeout, TimeUnit unit) <T> TinvokeAny(Collection<? extends Callable<T>> tasks) <T> TinvokeAny(Collection<? extends Callable<T>> tasks, long timeout, TimeUnit unit) booleanisClosed()Returnstrueif this object has been closed.booleanReturnstrueif theCloseable.close(boolean)method has been called.booleanbooleanvoidRemove a pre-registered close event listenervoidshutdown()Future<?> <T> Future<T> <T> Future<T> Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.apache.sshd.common.util.threads.CloseableExecutorService
awaitTermination, close
-
Field Details
-
executor
-
closeFuture
-
-
Constructor Details
-
NoCloseExecutor
-
-
Method Details
-
submit
- Specified by:
submitin interfaceExecutorService
-
submit
- Specified by:
submitin interfaceExecutorService
-
submit
- Specified by:
submitin interfaceExecutorService
-
invokeAll
public <T> List<Future<T>> invokeAll(Collection<? extends Callable<T>> tasks) throws InterruptedException - Specified by:
invokeAllin interfaceExecutorService- Throws:
InterruptedException
-
invokeAll
public <T> List<Future<T>> invokeAll(Collection<? extends Callable<T>> tasks, long timeout, TimeUnit unit) throws InterruptedException - Specified by:
invokeAllin interfaceExecutorService- Throws:
InterruptedException
-
invokeAny
public <T> T invokeAny(Collection<? extends Callable<T>> tasks) throws InterruptedException, ExecutionException - Specified by:
invokeAnyin interfaceExecutorService- Throws:
InterruptedExceptionExecutionException
-
invokeAny
public <T> T invokeAny(Collection<? extends Callable<T>> tasks, long timeout, TimeUnit unit) throws InterruptedException, ExecutionException, TimeoutException - Specified by:
invokeAnyin interfaceExecutorService- Throws:
InterruptedExceptionExecutionExceptionTimeoutException
-
execute
-
shutdown
public void shutdown()- Specified by:
shutdownin interfaceExecutorService
-
shutdownNow
- Specified by:
shutdownNowin interfaceExecutorService
-
isShutdown
public boolean isShutdown()- Specified by:
isShutdownin interfaceExecutorService
-
isTerminated
public boolean isTerminated()- Specified by:
isTerminatedin interfaceExecutorService
-
awaitTermination
- Specified by:
awaitTerminationin interfaceExecutorService- Throws:
InterruptedException
-
close
Description copied from interface:CloseableClose 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.- Specified by:
closein interfaceCloseable- Parameters:
immediately-trueif the resource should be shut down abruptly,falsefor a graceful close- Returns:
- a
CloseFuturerepresenting the close request
-
addCloseFutureListener
Description copied from interface:CloseablePre-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- Specified by:
addCloseFutureListenerin interfaceCloseable- Parameters:
listener- The notificationSshFutureListener- nevernull
-
removeCloseFutureListener
Description copied from interface:CloseableRemove a pre-registered close event listener- Specified by:
removeCloseFutureListenerin interfaceCloseable- Parameters:
listener- The registerSshFutureListener- nevernull. Ignored if not registered or resource already closed
-
isClosed
public boolean isClosed()Description copied from interface:CloseableReturnstrueif this object has been closed. -
isClosing
public boolean isClosing()Description copied from interface:CloseableReturnstrueif theCloseable.close(boolean)method has been called. Note that this method will returntrueeven if thisCloseable.isClosed()returnstrue.
-