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 Summary
Fields -
Method Summary
Modifier and TypeMethodDescriptionnewCachedThreadPool(ThreadFactory threadFactory) Creates a new cached thread poolnewScheduledThreadPool(ThreadPoolProfile profile, ThreadFactory threadFactory) Create a scheduled thread pool using the given thread pool profilenewThreadPool(ThreadPoolProfile profile, ThreadFactory threadFactory) Create a thread pool using the given thread pool profile
-
Field Details
-
FACTORY
-
-
Method Details
-
newCachedThreadPool
Creates a new cached thread pool The cached thread pool is a term from the JDK from the methodExecutors.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
Create a thread pool using the given thread pool profile- Parameters:
profile- parameters of the thread poolthreadFactory- 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 poolthreadFactory- factory for creating threads- Returns:
- the created thread pool
-