Class SshThreadPoolExecutor

  • All Implemented Interfaces:
    java.io.Closeable, java.lang.AutoCloseable, java.nio.channels.Channel, java.util.concurrent.Executor, java.util.concurrent.ExecutorService, Closeable, CloseableExecutorService

    public class SshThreadPoolExecutor
    extends java.util.concurrent.ThreadPoolExecutor
    implements CloseableExecutorService
    • Nested Class Summary

      Nested Classes 
      Modifier and Type Class Description
      protected class  SshThreadPoolExecutor.DelegateCloseable  
      • Nested classes/interfaces inherited from class java.util.concurrent.ThreadPoolExecutor

        java.util.concurrent.ThreadPoolExecutor.AbortPolicy, java.util.concurrent.ThreadPoolExecutor.CallerRunsPolicy, java.util.concurrent.ThreadPoolExecutor.DiscardOldestPolicy, java.util.concurrent.ThreadPoolExecutor.DiscardPolicy
    • Constructor Summary

      Constructors 
      Constructor Description
      SshThreadPoolExecutor​(int corePoolSize, int maximumPoolSize, long keepAliveTime, java.util.concurrent.TimeUnit unit, java.util.concurrent.BlockingQueue<java.lang.Runnable> workQueue)  
      SshThreadPoolExecutor​(int corePoolSize, int maximumPoolSize, long keepAliveTime, java.util.concurrent.TimeUnit unit, java.util.concurrent.BlockingQueue<java.lang.Runnable> workQueue, java.util.concurrent.RejectedExecutionHandler handler)  
      SshThreadPoolExecutor​(int corePoolSize, int maximumPoolSize, long keepAliveTime, java.util.concurrent.TimeUnit unit, java.util.concurrent.BlockingQueue<java.lang.Runnable> workQueue, java.util.concurrent.ThreadFactory threadFactory)  
      SshThreadPoolExecutor​(int corePoolSize, int maximumPoolSize, long keepAliveTime, java.util.concurrent.TimeUnit unit, java.util.concurrent.BlockingQueue<java.lang.Runnable> workQueue, java.util.concurrent.ThreadFactory threadFactory, java.util.concurrent.RejectedExecutionHandler handler)  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void addCloseFutureListener​(SshFutureListener<CloseFuture> listener)
      Pre-register a listener to be informed when resource is closed.
      boolean awaitTermination​(long timeout, java.util.concurrent.TimeUnit unit)  
      CloseFuture close​(boolean immediately)
      Close this resource asynchronously and return a future.
      boolean isClosed()
      Returns true if this object has been closed.
      boolean isClosing()
      Returns true if the Closeable.close(boolean) method has been called.
      boolean isShutdown()  
      boolean isTerminated()  
      boolean isTerminating()  
      void removeCloseFutureListener​(SshFutureListener<CloseFuture> listener)
      Remove a pre-registered close event listener
      void shutdown()  
      java.util.List<java.lang.Runnable> shutdownNow()  
      protected void terminated()  
      • 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 java.util.concurrent.Executor

        execute
      • Methods inherited from interface java.util.concurrent.ExecutorService

        invokeAll, invokeAll, invokeAny, invokeAny, submit, submit, submit
    • Constructor Detail

      • SshThreadPoolExecutor

        public SshThreadPoolExecutor​(int corePoolSize,
                                     int maximumPoolSize,
                                     long keepAliveTime,
                                     java.util.concurrent.TimeUnit unit,
                                     java.util.concurrent.BlockingQueue<java.lang.Runnable> workQueue)
      • SshThreadPoolExecutor

        public SshThreadPoolExecutor​(int corePoolSize,
                                     int maximumPoolSize,
                                     long keepAliveTime,
                                     java.util.concurrent.TimeUnit unit,
                                     java.util.concurrent.BlockingQueue<java.lang.Runnable> workQueue,
                                     java.util.concurrent.ThreadFactory threadFactory)
      • SshThreadPoolExecutor

        public SshThreadPoolExecutor​(int corePoolSize,
                                     int maximumPoolSize,
                                     long keepAliveTime,
                                     java.util.concurrent.TimeUnit unit,
                                     java.util.concurrent.BlockingQueue<java.lang.Runnable> workQueue,
                                     java.util.concurrent.RejectedExecutionHandler handler)
      • SshThreadPoolExecutor

        public SshThreadPoolExecutor​(int corePoolSize,
                                     int maximumPoolSize,
                                     long keepAliveTime,
                                     java.util.concurrent.TimeUnit unit,
                                     java.util.concurrent.BlockingQueue<java.lang.Runnable> workQueue,
                                     java.util.concurrent.ThreadFactory threadFactory,
                                     java.util.concurrent.RejectedExecutionHandler handler)
    • Method Detail

      • terminated

        protected void terminated()
        Overrides:
        terminated in class java.util.concurrent.ThreadPoolExecutor
      • shutdown

        public void shutdown()
        Specified by:
        shutdown in interface java.util.concurrent.ExecutorService
        Overrides:
        shutdown in class java.util.concurrent.ThreadPoolExecutor
      • shutdownNow

        public java.util.List<java.lang.Runnable> shutdownNow()
        Specified by:
        shutdownNow in interface java.util.concurrent.ExecutorService
        Overrides:
        shutdownNow in class java.util.concurrent.ThreadPoolExecutor
      • isShutdown

        public boolean isShutdown()
        Specified by:
        isShutdown in interface java.util.concurrent.ExecutorService
        Overrides:
        isShutdown in class java.util.concurrent.ThreadPoolExecutor
      • isTerminating

        public boolean isTerminating()
        Overrides:
        isTerminating in class java.util.concurrent.ThreadPoolExecutor
      • isTerminated

        public boolean isTerminated()
        Specified by:
        isTerminated in interface java.util.concurrent.ExecutorService
        Overrides:
        isTerminated in class java.util.concurrent.ThreadPoolExecutor
      • awaitTermination

        public boolean awaitTermination​(long timeout,
                                        java.util.concurrent.TimeUnit unit)
                                 throws java.lang.InterruptedException
        Specified by:
        awaitTermination in interface java.util.concurrent.ExecutorService
        Overrides:
        awaitTermination in class java.util.concurrent.ThreadPoolExecutor
        Throws:
        java.lang.InterruptedException
      • close

        public CloseFuture close​(boolean immediately)
        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 interface Closeable
        Parameters:
        immediately - true if the resource should be shut down abruptly, false for a graceful close
        Returns:
        a CloseFuture representing the close request
      • addCloseFutureListener

        public void addCloseFutureListener​(SshFutureListener<CloseFuture> listener)
        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 interface Closeable
        Parameters:
        listener - The notification SshFutureListener - never null
      • isClosed

        public boolean isClosed()
        Description copied from interface: Closeable
        Returns true if this object has been closed.
        Specified by:
        isClosed in interface Closeable
        Returns:
        true if closing