Class ThreadPoolConfig

  • All Implemented Interfaces:
    Freezable

    public final class ThreadPoolConfig
    extends AbstractConfig
    Contains configuration properties for creating thread pools used by transports.
    • Field Detail

      • threadPoolName

        private String threadPoolName
        Name of the thread pool.
      • ioThreads

        private int ioThreads
        Number of I/O threads. 0 uses the default number of threads.
      • messageThreads

        private int messageThreads
        Number of message threads. 0 uses the default number of threads. -1 means do not configure a separate message thread pool
    • Constructor Detail

      • ThreadPoolConfig

        public ThreadPoolConfig()
    • Method Detail

      • getThreadPoolName

        public String getThreadPoolName()
        Returns the thread pool name.
        Returns:
        thread pool name
      • setThreadPoolName

        public void setThreadPoolName​(String name)
        Sets the thread pool name.
        Parameters:
        name - thread pool name
      • getIoThreads

        public int getIoThreads()
        Returns the number of I/O threads.
        Returns:
        number of I/O threads
      • setIoThreads

        public void setIoThreads​(int count)
        Sets the number of I/O threads.
        Parameters:
        count - number of I/O threads
      • getMessageThreads

        public int getMessageThreads()
        Returns the number of message threads.
        Returns:
        number of message threads
      • setMessageThreads

        public void setMessageThreads​(int count)
        Sets the number of message threads.
        Parameters:
        count - number of message threads
      • getShutdownStrategy

        public ThreadPoolConfig.ShutdownStrategy getShutdownStrategy()
        Returns the thread pool shutdown strategy.
        Returns:
        thread pool shutdown strategy
      • setShutdownStrategy

        public void setShutdownStrategy​(ThreadPoolConfig.ShutdownStrategy strategy)
        Sets thread pool shutdown strategy.
        Parameters:
        strategy - thread pool shutdown strategy
      • singleIoThread

        public static ThreadPoolConfig singleIoThread​(String name,
                                                      ThreadPoolConfig.ShutdownStrategy strategy)
        Creates a new transport config that uses a single I/O thread.
        Parameters:
        name - of the thread pool
        strategy - transport shutdown strategy
        Returns:
        transport config
      • defaultIoThreads

        public static ThreadPoolConfig defaultIoThreads​(String name,
                                                        ThreadPoolConfig.ShutdownStrategy strategy)
        Creates a new transport config that uses the default number of I/O threads and no message worker threads.
        Parameters:
        name - of the thread pool
        strategy - transport shutdown strategy
        Returns:
        transport config