gnodet-bot commented on code in PR #30000:
URL: https://github.com/apache/camel/pull/30000#discussion_r4578059774
##########
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:
⚠️ **Misleading comment**: `CallerRunsPolicy` on a shut-down pool drops the
task silently — it neither runs it nor throws. `AbortPolicy` throws without
running. The comment "the rejection policy ran the task before it threw"
describes a custom handler that does both — a rare, non-standard scenario.
Without a custom handler this branch is unreachable.
Consider clarifying:
```suggestion
// a custom rejection policy ran the task synchronously before
throwing: the task completes the exchange
```
##########
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:
⚠️ **Incomplete upgrade guide entry**: the entry documents CAMEL-26538
(pool-per-context) but omits the CAMEL-26951 behavioral change introduced by
this PR: calls to a stopped-context API endpoint now fail with
`RejectedExecutionException` instead of being silently dropped. Users in
shutdown-race scenarios will see new exceptions.
```suggestion
=== 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.
A call to an API component producer whose CamelContext has stopped now fails
the exchange with a
`RejectedExecutionException`, instead of being silently dropped. A call made
while the CamelContext is stopping
and waiting for its in-flight exchanges still completes normally.
```
--
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]