Class ExecutorServiceConfigurator


  • public class ExecutorServiceConfigurator
    extends Object
    Exposes aspects of a wrapped ThreadPoolExecutor's configuration. {Alink ExecutorService} decorators can choose to expose instances of this class rather than breaking encapsulation of the ExecutorService that they wrap.
    Since:
    13.0.0
    • Constructor Detail

      • ExecutorServiceConfigurator

        public ExecutorServiceConfigurator​(ThreadPoolExecutor delegate)
        Constructs a new ExecutorServiceConfigurator.
        Parameters:
        delegate - The ThreadPoolExecutor instance.
    • Method Detail

      • setCorePoolSize

        public void setCorePoolSize​(int corePoolSize)
        Sets the core number of threads.
        Parameters:
        corePoolSize - the new core size
        See Also:
        ThreadPoolExecutor.setCorePoolSize(int)
      • setMaximumPoolSize

        public void setMaximumPoolSize​(int maximumPoolSize)
        Sets the maximum allowed number of threads.
        Parameters:
        maximumPoolSize - the new maximum
        See Also:
        ThreadPoolExecutor.setMaximumPoolSize(int)
      • getMaximumPoolSize

        public int getMaximumPoolSize()
        Returns the maximum allowed number of threads.
        Returns:
        the maximum allowed number of threads
        See Also:
        ThreadPoolExecutor.getMaximumPoolSize()
      • setKeepAliveTime

        public void setKeepAliveTime​(long time,
                                     TimeUnit unit)
        Sets the time limit for which threads may remain idle before being terminated.
        Parameters:
        time - the time to wait. A time value of zero will cause excess threads to terminate immediately after executing tasks.
        unit - the time unit of the time argument
        See Also:
        ThreadPoolExecutor.setKeepAliveTime(long, TimeUnit)