Camel 2.3 - ThreadPool ConfigurationPage edited by Claus IbsenDesign Notes for ThreadPool ConfigurationCAMEL-1588 is the ticket for a new and improved thread pool configuration for Apache Camel. Its intended for Camel 2.3. ScopeCamel uses thread pool in various places such as EIP patterns, Components, Async API and whatnot. The aim is to improved and allow easier to configure those thread pools in a more streamlined manner. The goal is to offer both a fine grained configuration where you can tweak individual pools and have more coarse grained configuration with fallback to global settings etc. Outside scopeSome components provides their own thread pool configuration and management which Camel of course cannot and should not try to tailor with. For example Jetty is such an example. Usages of thread pools in CamelCurrently Camel uses thread pools in camel-core in the following areas:
Existing configurationYou can configure the thread pool using the setExecutorService setter methods that usually exists on those places where its in use. Some EIP patterns offer a executorServiceRef option to refer to some pool to be looked up in the Registry. Using default ThreadPoolsWe should use CachedThreadPool from the JDK Core as its the best general purpose pool for many short lived tasks, which is what Camel really does. Processing many messages in a short live. DONE Only used SingleExecutorService for background tasks, and ScheduledExecutorService for scheduled tasks DONE ThreadPool scopeIt should be possible to configure a thread pool on either per CamelContext level or per Route level, such as you can do with AutoStartup and the likes. The problem with shutdown and restarting poolsThe ExecutorService API does not allow to restart a thread pool, which is PITA. So we need to find a better strategy for stopping vs. shutdown. We may have to only shutdown thread pools if CamelContext is stopping. And then if end user stop a route from JMX we can keep the thread pool around. The problem with Component, EndpointThe DefaultComponent and DefaultEndpoint exposes API to get an ExecutorService. We should retrofit this API a bit so it can get hold of any external configured more easily. Also it should be able to use if you configure a shared pool on a per route or per camel context basis. Managed thread poolCheck whether the thread pools is managed by default and avail in JConsole. If not we should probably at least expose some read-only data about the pools. Spring Factory for creating custom poolsCreate a Spring XML DSL for defining thread pools using custom options such as corePoolSize, maxPoolSize, keepAlive, thread name etc. DONE
Change Notification Preferences
View Online
|
View Change
|
Add Comment
|
- [CONF] Apache Camel > Camel 2.3 - ThreadPool Configuration confluence
- [CONF] Apache Camel > Camel 2.3 - ThreadPool Configurat... confluence
- [CONF] Apache Camel > Camel 2.3 - ThreadPool Configurat... confluence
- [CONF] Apache Camel > Camel 2.3 - ThreadPool Configurat... confluence
- [CONF] Apache Camel > Camel 2.3 - ThreadPool Configurat... confluence
- [CONF] Apache Camel > Camel 2.3 - ThreadPool Configurat... confluence
- [CONF] Apache Camel > Camel 2.3 - ThreadPool Configurat... confluence
- [CONF] Apache Camel > Camel 2.3 - ThreadPool Configurat... confluence
- [CONF] Apache Camel > Camel 2.3 - ThreadPool Configurat... confluence
- [CONF] Apache Camel > Camel 2.3 - ThreadPool Configurat... confluence
- [CONF] Apache Camel > Camel 2.3 - ThreadPool Configurat... confluence
- [CONF] Apache Camel > Camel 2.3 - ThreadPool Configurat... confluence