Class SshThreadPoolExecutor
- java.lang.Object
-
- java.util.concurrent.AbstractExecutorService
-
- java.util.concurrent.ThreadPoolExecutor
-
- org.apache.sshd.common.util.threads.SshThreadPoolExecutor
-
- All Implemented Interfaces:
Closeable,AutoCloseable,Channel,Executor,ExecutorService,Closeable,CloseableExecutorService
public class SshThreadPoolExecutor extends ThreadPoolExecutor implements CloseableExecutorService
- Author:
- Apache MINA SSHD Project
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description protected classSshThreadPoolExecutor.DelegateCloseable-
Nested classes/interfaces inherited from class java.util.concurrent.ThreadPoolExecutor
ThreadPoolExecutor.AbortPolicy, ThreadPoolExecutor.CallerRunsPolicy, ThreadPoolExecutor.DiscardOldestPolicy, ThreadPoolExecutor.DiscardPolicy
-
-
Field Summary
Fields Modifier and Type Field Description protected SshThreadPoolExecutor.DelegateCloseablecloseable
-
Constructor Summary
Constructors Constructor Description SshThreadPoolExecutor(int corePoolSize, int maximumPoolSize, long keepAliveTime, TimeUnit unit, BlockingQueue<Runnable> workQueue)SshThreadPoolExecutor(int corePoolSize, int maximumPoolSize, long keepAliveTime, TimeUnit unit, BlockingQueue<Runnable> workQueue, RejectedExecutionHandler handler)SshThreadPoolExecutor(int corePoolSize, int maximumPoolSize, long keepAliveTime, TimeUnit unit, BlockingQueue<Runnable> workQueue, ThreadFactory threadFactory)SshThreadPoolExecutor(int corePoolSize, int maximumPoolSize, long keepAliveTime, TimeUnit unit, BlockingQueue<Runnable> workQueue, ThreadFactory threadFactory, RejectedExecutionHandler handler)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddCloseFutureListener(SshFutureListener<CloseFuture> listener)Pre-register a listener to be informed when resource is closed.booleanawaitTermination(long timeout, TimeUnit unit)CloseFutureclose(boolean immediately)Close this resource asynchronously and return a future.booleanisClosed()Returnstrueif this object has been closed.booleanisClosing()Returnstrueif theCloseable.close(boolean)method has been called.booleanisShutdown()booleanisTerminated()booleanisTerminating()voidremoveCloseFutureListener(SshFutureListener<CloseFuture> listener)Remove a pre-registered close event listenervoidshutdown()List<Runnable>shutdownNow()protected voidterminated()-
Methods inherited from class java.util.concurrent.ThreadPoolExecutor
afterExecute, allowCoreThreadTimeOut, allowsCoreThreadTimeOut, beforeExecute, execute, finalize, getActiveCount, getCompletedTaskCount, getCorePoolSize, getKeepAliveTime, getLargestPoolSize, getMaximumPoolSize, getPoolSize, getQueue, getRejectedExecutionHandler, getTaskCount, getThreadFactory, prestartAllCoreThreads, prestartCoreThread, purge, remove, setCorePoolSize, setKeepAliveTime, setMaximumPoolSize, setRejectedExecutionHandler, setThreadFactory, toString
-
Methods inherited from class java.util.concurrent.AbstractExecutorService
invokeAll, invokeAll, invokeAny, invokeAny, newTaskFor, newTaskFor, submit, submit, submit
-
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface org.apache.sshd.common.util.threads.CloseableExecutorService
awaitTermination
-
-
-
-
Field Detail
-
closeable
protected final SshThreadPoolExecutor.DelegateCloseable closeable
-
-
Constructor Detail
-
SshThreadPoolExecutor
public SshThreadPoolExecutor(int corePoolSize, int maximumPoolSize, long keepAliveTime, TimeUnit unit, BlockingQueue<Runnable> workQueue)
-
SshThreadPoolExecutor
public SshThreadPoolExecutor(int corePoolSize, int maximumPoolSize, long keepAliveTime, TimeUnit unit, BlockingQueue<Runnable> workQueue, ThreadFactory threadFactory)
-
SshThreadPoolExecutor
public SshThreadPoolExecutor(int corePoolSize, int maximumPoolSize, long keepAliveTime, TimeUnit unit, BlockingQueue<Runnable> workQueue, RejectedExecutionHandler handler)
-
SshThreadPoolExecutor
public SshThreadPoolExecutor(int corePoolSize, int maximumPoolSize, long keepAliveTime, TimeUnit unit, BlockingQueue<Runnable> workQueue, ThreadFactory threadFactory, RejectedExecutionHandler handler)
-
-
Method Detail
-
terminated
protected void terminated()
- Overrides:
terminatedin classThreadPoolExecutor
-
shutdown
public void shutdown()
- Specified by:
shutdownin interfaceExecutorService- Overrides:
shutdownin classThreadPoolExecutor
-
shutdownNow
public List<Runnable> shutdownNow()
- Specified by:
shutdownNowin interfaceExecutorService- Overrides:
shutdownNowin classThreadPoolExecutor
-
isShutdown
public boolean isShutdown()
- Specified by:
isShutdownin interfaceExecutorService- Overrides:
isShutdownin classThreadPoolExecutor
-
isTerminating
public boolean isTerminating()
- Overrides:
isTerminatingin classThreadPoolExecutor
-
isTerminated
public boolean isTerminated()
- Specified by:
isTerminatedin interfaceExecutorService- Overrides:
isTerminatedin classThreadPoolExecutor
-
awaitTermination
public boolean awaitTermination(long timeout, TimeUnit unit) throws InterruptedException- Specified by:
awaitTerminationin interfaceExecutorService- Overrides:
awaitTerminationin classThreadPoolExecutor- Throws:
InterruptedException
-
close
public CloseFuture close(boolean immediately)
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
public void addCloseFutureListener(SshFutureListener<CloseFuture> listener)
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
public void removeCloseFutureListener(SshFutureListener<CloseFuture> listener)
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.
-
-