Adriano Machado created CAMEL-26557:
---------------------------------------

             Summary: camel-util - BoundedExecutorService: a task of the 
executor runs nested work inline with the Abort policy too
                 Key: CAMEL-26557
                 URL: https://issues.apache.org/jira/browse/CAMEL-26557
             Project: Camel
          Issue Type: Sub-task
            Reporter: Adriano Machado
             Fix For: 4.24.0


With virtual threads, a parallel split or multicast whose thread pool profile 
uses the Abort rejected policy runs one item fewer at a time than maxQueueSize 
allows.

The dispatcher task of the split runs in the BoundedExecutorService and submits 
itself again for each item while it holds a permit. CAMEL\-26478 made a task of 
the executor run nested work inline when no permit is free, but only with the 
CallerRuns and Block policies. With Abort the dispatcher still waits for a 
permit while holding one, so one permit is always taken by the dispatcher. With 
maxQueueSize=1 it waits keepAliveTime for the permit it holds itself and is 
then rejected.

Measured with 10 items of 300 ms, peak items running at once for maxQueueSize 
1/2/3:
\- CallerRuns and Block: 1/2/3
\- Abort: rejected/1/2

SplitterParallelAsyncProcessorIssueTest fails in virtual mode because of this 
\(5.2 s instead of 2.7 s\), and also because it counts distinct thread names, 
which grow with the number of tasks when every task gets a new virtual thread.

Proposed fix: a task of the executor runs nested work inline with the Abort 
policy too. A submitter outside the executor still waits and is rejected as 
before, so backpressure does not change. The splitter test measures the items 
running at once instead of thread names.

_Claude Code on behalf of Adriano Machado \(@ammachado\)_

_This was generated by an AI agent and may contain inaccuracies. Please verify 
before relying on it._





--
This message was sent by Atlassian Jira
(v10.3.26#10030026)

Reply via email to