davsclaus commented on code in PR #30000:
URL: https://github.com/apache/camel/pull/30000#discussion_r4578320447
##########
core/camel-support/src/main/java/org/apache/camel/support/component/AbstractApiProducer.java:
##########
@@ -114,10 +124,47 @@ public void run() {
}
};
- endpoint.getExecutorService().submit(invocation);
+ final ExecutorService executorService;
+ try {
+ executorService = endpoint.getExecutorService();
+ } catch (RejectedExecutionException e) {
+ // the CamelContext has stopped, and has no pool for this endpoint
+ return rejected(exchange, callback, e);
+ }
+ if (executorService.isShutdown()) {
+ // the CallerRuns policy of a shut down pool would drop the task
without running it, and the exchange would
+ // never complete
+ return rejected(exchange, callback, newRejectedException(method));
+ }
+ try {
+ executorService.submit(invocation);
+ } catch (RejectedExecutionException e) {
+ if (claimed.compareAndSet(false, true)) {
+ return rejected(exchange, callback, e);
+ }
+ // the rejection policy ran the task before it threw, and the task
completes the exchange
Review Comment:
Fixed in 4c71eebb: the comment at `AbstractApiProducer.java:145-146` now
says only a custom rejection policy runs the task and then throws, not the JDK
CallerRuns and Abort policies. Resolving.
_Claude Code on behalf of davsclaus_
##########
docs/user-manual/modules/ROOT/pages/camel-4x-upgrade-guide-4_24.adoc:
##########
@@ -1191,6 +1191,13 @@ as `camel run` already did. Before, the failure left
`main()` and only the JVM p
The JVM no longer prints that same failure a second time. When the application
logs nothing at ERROR (such as without
a logging implementation), the JVM prints it as before.
+=== camel-support - API components use one thread pool per CamelContext
+
+The producers of the API components (AS2, Box, Braintree, DHIS2, FHIR, Google
Calendar, Google Drive, Google Mail,
+Google Sheets, Twilio and Zendesk) now use one thread pool per component in
each CamelContext, instead of one pool
+shared by all the CamelContexts of the JVM. An application with several
CamelContexts can therefore have more threads,
+and each pool uses the thread pool profile (such as `CamelGoogleDrive`) of its
own CamelContext.
+
Review Comment:
The author is right: this section comes from #29999, already on main. Once
the duplicate CAMEL-26538 commit is dropped by the rebase, this PR does not
touch the upgrade guide, and a call that used to hang and now fails needs no
entry. Resolving.
_Claude Code on behalf of davsclaus_
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]