ExecutorFactory (Apache Tomcat 11.0.24 API Documentation)
Description: declaration: package: org.apache.catalina.tribes.util, class: ExecutorFactory

# Class ExecutorFactory

java.lang.Object
org.apache.catalina.tribes.util.ExecutorFactory

public class ExecutorFactory extends Object
Factory for creating thread pool executors for Tribes clustering.

- ## Field Summary

  Fields
  Modifier and Type
  Field
  Description
  `protected static final StringManager`
  `sm`
  String manager for this class.

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `ExecutorFactory()`
  Default constructor for ExecutorFactory.

- ## Method Summary

  Modifier and Type
  Method
  Description
  `static ExecutorService`
  `newThreadPool(int minThreads, int maxThreads, long maxIdleTime, TimeUnit unit)`
  Creates a new thread pool executor with the specified parameters.
  `static ExecutorService`
  `newThreadPool(int minThreads, int maxThreads, long maxIdleTime, TimeUnit unit, ThreadFactory threadFactory)`
  Creates a new thread pool executor with the specified parameters and thread factory.

  ### Methods inherited from class Object

  `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- ## Field Details

  - ### sm

    protected static final StringManager sm
    String manager for this class.

- ## Constructor Details

  - ### ExecutorFactory

    public ExecutorFactory()
    Default constructor for ExecutorFactory.

- ## Method Details

  - ### newThreadPool

    public static ExecutorService newThreadPool(int minThreads, int maxThreads, long maxIdleTime, TimeUnit unit)
    Creates a new thread pool executor with the specified parameters.
    Parameters:
      `minThreads` - The minimum number of threads
      `maxThreads` - The maximum number of threads
      `maxIdleTime` - The maximum idle time for threads
      `unit` - The time unit for maxIdleTime
    Returns:
      the new thread pool executor

  - ### newThreadPool

    public static ExecutorService newThreadPool(int minThreads, int maxThreads, long maxIdleTime, TimeUnit unit, ThreadFactory threadFactory)
    Creates a new thread pool executor with the specified parameters and thread factory.
    Parameters:
      `minThreads` - The minimum number of threads
      `maxThreads` - The maximum number of threads
      `maxIdleTime` - The maximum idle time for threads
      `unit` - The time unit for maxIdleTime
      `threadFactory` - The thread factory to use
    Returns:
      the new thread pool executor