Henryk Konsek created CAMEL-7240:
------------------------------------
Summary: ThreadsProcessor should resolve RejectedPolicy from the
referenced ThreadPoolProfile
Key: CAMEL-7240
URL: https://issues.apache.org/jira/browse/CAMEL-7240
Project: Camel
Issue Type: Bug
Components: camel-core
Reporter: Henryk Konsek
Fix For: 2.13.0
Hi,
{{ThreadsProcessor}} uses {{rejectedPolicy}} field to determine if it should
set the exception on the exchange.
{code}
boolean abort = ThreadPoolRejectedPolicy.Abort == rejectedPolicy;
if (abort) {
exchange.setException(new RejectedExecutionException());
}
{code}
Unfortunately {{ThreadsDefinition}} reads {{rejectedPolicy}} only if the latter
is set directly on the Threads definition level. If {{getExecutorServiceRef}}
is set on the {{ThreadsDefinition}}, the {{rejectedPolicy}} value from the
referenced thread pool profile is ignored.
{code}
ThreadsProcessor thread = ...;
...
thread.setRejectedPolicy(getRejectedPolicy());
{code}
That leads to the situations when task is rejected, but exception is not set on
the exchange, because {{ThreadsProcessor}} is unaware of the effective
rejection policy.
The following configuration demonstrates the issue:
{code}
<threadPool id="bigPool" poolSize="1" maxPoolSize="1" threadName="foo"
maxQueueSize="1" rejectedPolicy="Abort"/>
...
<threads executorServiceRef="bigPool" ...>
...
{code}
{{ThreadsProcessor}} should resolve the rejection policy from the thread pool
profile if one is referenced with the {{ExecutorServiceRef}} option.
--
This message was sent by Atlassian JIRA
(v6.1.5#6160)