allthingssecurity commented on PR #30759:
URL: https://github.com/apache/camel/pull/30759#issuecomment-7156538631

   Thanks Claus. All points are in three new commits, e471e08d03, 0b430364f7 
and fd6d52bb75 (an upgrade guide line for the new internal 
`ExchangeExtension.nextAwaitOrder()`).
   
   1. `interrupt(Exchange)` now releases only the waiter whose `process()` call 
started last (the innermost one); the outer one goes on when the route on the 
inner thread ends and fires its callback, as on main. `doStop` still interrupts 
every entry, and the entry per thread stays, so at stop both threads of a 
nested wait now go on at once (releasing the innermost first there could be a 
follow-up). The order is taken when `process()` starts, before the processor 
runs, since the inner thread can block before the outer one. It is kept on the 
exchange (`ExchangeExtension.nextAwaitOrder()`, a plain field), as only waiters 
of the same exchange are compared. The Javadoc of `interrupt` in 
`AsyncProcessorAwaitManager` and the impl say this. New test 
`interruptOfNestedWaitersReleasesTheInnerOneAndTheOuterOneThroughItsCallback` 
(the inner thread blocks first; a counter checks the interrupt does not release 
both threads); it fails on the first head of this PR (a149d10bb4) and on main.
   2. `AwaitThreadEntry.interrupt()`/`finish()` use a `ReentrantLock` now.
   3. `interrupt(Exchange)` releases one entry; the WARN line is built in a 
try, the thread is released whatever it throws, and the exception is thrown 
after.
   4. Dropped `@Isolated`. The await manager tests pass 20 times in one JVM 
with JUnit parallel on and off (360 run each, 0 failures).
   5. Added the comment: the bin selection only matters for the map of main.
   
   On cost: e471e08d03 took the order from one `AtomicLong` of the manager on 
every `process()` call, which made a sync `sendBody` to a two-step direct route 
about 12% slower at 12 threads in a quick benchmark. With the counter on the 
exchange (0b430364f7) it is within the noise of main at 1, 4 and 12 threads; 
the numbers are in the PR body. The module tests pass (354 run, 0 failures), 
and it still merges cleanly with main and with #30739.
   


-- 
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]

Reply via email to