[ 
https://issues.apache.org/jira/browse/CAMEL-4244?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Christian Schneider updated CAMEL-4244:
---------------------------------------

    Attachment: CAMEL-4244.patch

Here my current version of the fix for this issue.

I changed the executorServiceStrategy to an executorServiceManager which is 
more accurate to what it does. The interface of this now contains much less 
methods. Most cases are now done by calling 
getExecutorService/(ThreadPoolProfile profile, Object source).

So the special cases can be configured using a ThreadPooBuilder which already 
has convenience methods for single and fixed thread pools.

The handling of default values is also much streamlined. The folowing override 
is in place. General DefaultProfile => 
configured profile in the ExecutorServiceManager ==> Profile values on call. So 
it is much clearer where to change the default values. Before it default values 
where processed at different places.

Another improvedment is the introduction of a ThreadPoolFactory interfaces. 
This allows to customize the thread pool creation by implementing only two 
simple methods.

At the moment I still get 2 test failures as the jmx names of the thread pools 
are not the same as before. They now come from the thread name not the profile 
id. No idea where that happens and how it worked before. I would be glad to get 
help with this issue.

> Refactor ExecutorService classes into a InstanceManagerPattern
> --------------------------------------------------------------
>
>                 Key: CAMEL-4244
>                 URL: https://issues.apache.org/jira/browse/CAMEL-4244
>             Project: Camel
>          Issue Type: Improvement
>    Affects Versions: 2.8.0
>            Reporter: Christian Schneider
>            Assignee: Christian Schneider
>             Fix For: 2.9.0
>
>         Attachments: CAMEL-4244.patch
>
>
> Currently the management of ExecutorSevices is scattered of several classes. 
> I would like to refactor this to the 
> http://c2.com/cgi/wiki?InstanceManagerPattern
> So there simply is one instance manager where ExecutorServices can be looked 
> up and created on demand. This would replace :
> - org.apache.camel.impl.DefaultExecutorServiceStrategy
> - org.apache.camel.spi.ExecutorServiceStrategy
> - org.apache.camel.util.concurrent.ExecutorServiceHelper
> The complete configuration should be in the manager so it does not have a 
> reference to CamelContext. An instance of the manager can be retrieved or set 
> on the camel context.
> Currently a class that needs an executorService asks the 
> ExecutorServiceHelper if there is already a suitable service. If there is 
> none it creates it. This should be changed so the class that needs the 
> ExecutorService just asks the ExecutorServiceManager for a suitable service 
> and it will be created on the fly if none is available. So the whole 
> management is concentrated in one class.
> The disadvantage is that there is no strategy anymore. So someone who wants 
> to implement a new manager has to do the whole job. I think that this is not 
> such a big problem though and we can reintroduce a strategy if it is really 
> needed.

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

Reply via email to