davsclaus commented on code in PR #30304:
URL: https://github.com/apache/camel/pull/30304#discussion_r4611158991
##########
core/camel-core-processor/src/main/java/org/apache/camel/processor/ConcurrentRequestsThrottler.java:
##########
@@ -183,14 +183,16 @@ private static void doThrottle(Exchange exchange,
ThrottlingState throttlingStat
*/
protected boolean processAsynchronously(
final Exchange exchange, final AsyncCallback callback,
ThrottlingState throttlingState) {
+ AsyncCall call = newAsyncCall(exchange, callback);
try {
if (LOG.isTraceEnabled()) {
exchange.setProperty(PROPERTY_EXCHANGE_QUEUED_TIME,
TimeSource.nanoTime());
}
exchange.setProperty(PROPERTY_EXCHANGE_STATE, State.ASYNC);
- asyncExecutor.submit(() -> process(exchange, callback));
+ asyncExecutor.submit(call);
return false;
} catch (final RejectedExecutionException e) {
+ call.rejected();
Review Comment:
Fixed: `rejected()` returns the remove result and the catch block returns
false when doShutdown already claimed the call.
_Claude Code on behalf of davsclaus_
##########
core/camel-core-processor/src/main/java/org/apache/camel/processor/DelayProcessorSupport.java:
##########
@@ -130,6 +140,7 @@ protected boolean processDelay(Exchange exchange,
AsyncCallback callback, long d
return false;
} catch (RejectedExecutionException e) {
// we were not allowed to run the ProcessCall, so need to
decrement the counter here
+ scheduledCalls.remove(call);
Review Comment:
Fixed: the catch block returns before the decrement when
`scheduledCalls.remove(call)` is false.
_Claude Code on behalf of davsclaus_
##########
core/camel-core-processor/src/main/java/org/apache/camel/processor/ConcurrentRequestsThrottler.java:
##########
@@ -183,14 +183,16 @@ private static void doThrottle(Exchange exchange,
ThrottlingState throttlingStat
*/
protected boolean processAsynchronously(
final Exchange exchange, final AsyncCallback callback,
ThrottlingState throttlingState) {
+ AsyncCall call = newAsyncCall(exchange, callback);
try {
if (LOG.isTraceEnabled()) {
exchange.setProperty(PROPERTY_EXCHANGE_QUEUED_TIME,
TimeSource.nanoTime());
}
exchange.setProperty(PROPERTY_EXCHANGE_STATE, State.ASYNC);
- asyncExecutor.submit(() -> process(exchange, callback));
+ asyncExecutor.submit(call);
return false;
} catch (final RejectedExecutionException e) {
+ call.rejected();
if (isCallerRunsWhenRejected()) {
Review Comment:
Fixed in the new commit: the `rejected()` guard at the start of the catch
block (ConcurrentRequestsThrottler line 196).
_Claude Code on behalf of davsclaus_
##########
core/camel-core-processor/src/main/java/org/apache/camel/processor/TotalRequestsThrottler.java:
##########
@@ -201,9 +202,10 @@ protected boolean processAsynchronously(
// exchanges and not yet returned, so try again after one period
long delay = next != null
? next.getDelay(TimeUnit.NANOSECONDS) :
TimeUnit.MILLISECONDS.toNanos(getTimePeriodMillis());
- asyncExecutor.schedule(() -> process(exchange, callback), delay,
TimeUnit.NANOSECONDS);
+ asyncExecutor.schedule(call, delay, TimeUnit.NANOSECONDS);
return false;
} catch (final RejectedExecutionException e) {
+ call.rejected();
if (isCallerRunsWhenRejected()) {
Review Comment:
Fixed: same guard in TotalRequestsThrottler (line 209).
_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]