[
https://issues.apache.org/jira/browse/CAMEL-9153?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14933779#comment-14933779
]
Michael Riedel commented on CAMEL-9153:
---------------------------------------
Ok, I just attached a new patch, which uses and if-else, as suggested. The
patch also contains a new unit test.
Writing that test revealed that checking whether or not the {{Rejectable}}
interface is implemented is pretty much pointless. That is because
{{ThreadPoolExecutor}} does not pass the submitted {{Runnable}}/{{Callable}}
task itself, but instead passes whatever is returned by one of its
{{newTaskFor}} methods.
For Camel's {{RejectableThreadPoolExecutor}} these always return an instance of
{{Rejectable}}, more specifically {{RejectableFutureTask}}. I adjusted that, so
that they only return a {{Rejectable}}, if the given {{Runnable}}/{{Callable}}
task itself is {{Rejectable}}. That change is also contained in the patch.
_Sorry if code conventions are not quite right yet. I'm still struggling with
Checkstyle. However, I did use the Camel's Eclipse code-formatter, as generated
by {{mvn -Psetup.eclipse}}. Hope that helped. (Although it apparently changed
some line-wrapping, too.)_
> 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.17.0
>
> Attachments: ThreadPoolRejectedPolicy-Abort.patch,
> ThreadPoolRejectedPolicy-AbortNonRejectable.patch,
> ThreadPoolRejectedPolicy-AbortNonRejectable.patch,
> ThreadPoolRejectedPolicy-AbortWithException.patch,
> ThreadPoolRejectedPolicy-RejectableThreadPoolExecutor-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)