[
https://issues.apache.org/jira/browse/CAMEL-9153?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14908768#comment-14908768
]
Michael Riedel commented on CAMEL-9153:
---------------------------------------
In any case, I still wonder if it might be preferable for
{{ThreadPoolRejectedPolicy.Abort}} to always throw a
{{RejectedExecutionException}} (after invoking `Rejectable.reject()`, if
applicable)? It seems that the code in {{ThreadsProcessor}} could be adjusted
to accommodate such behavior. After all, it already does catch
{{RejectedExecutionExceptions}} (currently line 139), and some of the rejection
behavior is being handled there.
I tried to tinker with the code to implement that approach, and I'll attach
another patch for that. I have no new unit tests, but at least the additional
changes in {{ThreadsProcessor}} make {{ThreadsRejectedExecutionTest}} green
again. Not sure if it does not raise other problems elsewhere. In particular,
I'm a little confused about how the {{ThreadPoolRejectedPolicy}} should
correctly interact with the {{callerRunsWhenRejected}} flag? That flag seems a
little redundant anyway, maybe a legacy solution?
> ThreadPoolRejectedPolicy does not implement Abort as expected
> -------------------------------------------------------------
>
> Key: CAMEL-9153
> URL: https://issues.apache.org/jira/browse/CAMEL-9153
> Project: Camel
> Issue Type: Improvement
> Components: camel-core
> Reporter: Michael Riedel
> Priority: Minor
> Fix For: 2.16.0
>
> Attachments: ThreadPoolRejectedPolicy-Abort.patch,
> ThreadPoolRejectedPolicy-AbortNonRejectable.patch,
> ThreadPoolRejectedPolicy-AbortNonRejectable.patch
>
>
> Not sure if this is a bug or just a documentation flaw (in fact I could not
> find documentation for it). Nevertheless, as a naive user, I kind of expected
> that the {{RejectedExecutionHandler}} of {{ThreadPoolRejectedPolicy.Abort}}
> would have similar semantics as Java's {{ThreadPoolExecutor.AbortPolicy}}.
> That is, I expected it to throw an {{Exception}}.
> Currently (that is in the 2.15.2 release, and on the master branch in git)
> that is not the case. In fact, {{Abort}} seems to work exactly the same way
> as {{Discard}}.
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)