Details
-
Bug
-
Status: Resolved
-
Major
-
Resolution: Fixed
-
None
-
None
-
Unknown
Description
Hi,
ThreadsProcessor uses rejectedPolicy field to determine if it should set the exception on the exchange.
boolean abort = ThreadPoolRejectedPolicy.Abort == rejectedPolicy; if (abort) { exchange.setException(new RejectedExecutionException()); }
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.
ThreadsProcessor thread = ...; ... thread.setRejectedPolicy(getRejectedPolicy());
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:
<threadPool id="bigPool" poolSize="1" maxPoolSize="1" threadName="foo" maxQueueSize="1" rejectedPolicy="Abort"/> ... <threads executorServiceRef="bigPool" ...> ...
ThreadsProcessor should resolve the rejection policy from the thread pool profile if one is referenced with the ExecutorServiceRef option.