Class ThreadPoolConfig

All Implemented Interfaces:
Freezable

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

    • 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
    • shutdownStrategy

      private ThreadPoolConfig.ShutdownStrategy shutdownStrategy
      Thread pool shutdown strategy.
  • Constructor Details

    • ThreadPoolConfig

      public ThreadPoolConfig()
  • Method Details

    • 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
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • 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
    • builder

      public static ThreadPoolConfig.Builder builder()
      Creates a builder for this class.
      Returns:
      new builder