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
-
Nested Class Summary
Nested ClassesNested classes/interfaces inherited from class java.util.concurrent.ThreadPoolExecutor
ThreadPoolExecutor.AbortPolicy, ThreadPoolExecutor.CallerRunsPolicy, ThreadPoolExecutor.DiscardOldestPolicy, ThreadPoolExecutor.DiscardPolicy
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionSshThreadPoolExecutor
(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
Modifier and TypeMethodDescriptionvoid
addCloseFutureListener
(SshFutureListener<CloseFuture> listener) Pre-register a listener to be informed when resource is closed.boolean
awaitTermination
(long timeout, TimeUnit unit) close
(boolean immediately) Close this resource asynchronously and return a future.boolean
isClosed()
Returnstrue
if this object has been closed.boolean
Returnstrue
if theCloseable.close(boolean)
method has been called.boolean
boolean
boolean
void
Remove a pre-registered close event listenervoid
shutdown()
protected void
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 Details
-
closeable
-
-
Constructor Details
-
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 Details
-
terminated
protected void terminated()- Overrides:
terminated
in classThreadPoolExecutor
-
shutdown
public void shutdown()- Specified by:
shutdown
in interfaceExecutorService
- Overrides:
shutdown
in classThreadPoolExecutor
-
shutdownNow
- Specified by:
shutdownNow
in interfaceExecutorService
- Overrides:
shutdownNow
in classThreadPoolExecutor
-
isShutdown
public boolean isShutdown()- Specified by:
isShutdown
in interfaceExecutorService
- Overrides:
isShutdown
in classThreadPoolExecutor
-
isTerminating
public boolean isTerminating()- Overrides:
isTerminating
in classThreadPoolExecutor
-
isTerminated
public boolean isTerminated()- Specified by:
isTerminated
in interfaceExecutorService
- Overrides:
isTerminated
in classThreadPoolExecutor
-
awaitTermination
- Specified by:
awaitTermination
in interfaceExecutorService
- Overrides:
awaitTermination
in classThreadPoolExecutor
- Throws:
InterruptedException
-
close
Description copied from interface:Closeable
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.- Specified by:
close
in interfaceCloseable
- Parameters:
immediately
-true
if the resource should be shut down abruptly,false
for a graceful close- Returns:
- a
CloseFuture
representing the close request
-
addCloseFutureListener
Description copied from interface:Closeable
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- Specified by:
addCloseFutureListener
in interfaceCloseable
- Parameters:
listener
- The notificationSshFutureListener
- nevernull
-
removeCloseFutureListener
Description copied from interface:Closeable
Remove a pre-registered close event listener- Specified by:
removeCloseFutureListener
in interfaceCloseable
- Parameters:
listener
- The registerSshFutureListener
- nevernull
. Ignored if not registered or resource already closed
-
isClosed
public boolean isClosed()Description copied from interface:Closeable
Returnstrue
if this object has been closed. -
isClosing
public boolean isClosing()Description copied from interface:Closeable
Returnstrue
if theCloseable.close(boolean)
method has been called. Note that this method will returntrue
even if thisCloseable.isClosed()
returnstrue
.
-