Interface ThreadPoolFactory


public interface ThreadPoolFactory
Low-level SPI for constructing ExecutorService and ScheduledExecutorService instances from a ThreadPoolProfile and a ThreadFactory.

This interface uses only standard JDK types, which makes it the right customization point for environments (such as JEE application servers) where thread pool creation must be delegated to a managed thread pool or WorkManager rather than created directly via Executors. The higher-level ExecutorServiceManager handles Camel-specific concerns such as profile lookup, thread naming, lifecycle tracking, and graceful shutdown; this factory simply creates the pool when asked.

The factory is discovered via FactoryFinder using the key FACTORY. Camel ships DefaultThreadPoolFactory as the built-in implementation.

See Threading Model in the Camel user manual.

See Also:
  • Field Details

  • Method Details

    • newCachedThreadPool

      ExecutorService newCachedThreadPool(ThreadFactory threadFactory)
      Creates a new cached thread pool

      The cached thread pool is a term from the JDK from the method Executors.newCachedThreadPool().

      Typically, it will have no size limit (this is why it is handled separately)

      Parameters:
      threadFactory - factory for creating threads
      Returns:
      the created thread pool
    • newThreadPool

      ExecutorService newThreadPool(ThreadPoolProfile profile, ThreadFactory threadFactory)
      Create a thread pool using the given thread pool profile
      Parameters:
      profile - parameters of the thread pool
      threadFactory - factory for creating threads
      Returns:
      the created thread pool
    • newScheduledThreadPool

      ScheduledExecutorService newScheduledThreadPool(ThreadPoolProfile profile, ThreadFactory threadFactory)
      Create a scheduled thread pool using the given thread pool profile
      Parameters:
      profile - parameters of the thread pool
      threadFactory - factory for creating threads
      Returns:
      the created thread pool