gnodet opened a new pull request, #25281:
URL: https://github.com/apache/camel/pull/25281

   ## Summary
   
   _Claude Code on behalf of gnodet_
   
   Fix the root cause of the SEDA virtual thread shutdown hang (CAMEL-23129). 
The previous fix added a timeout to `latch.await()` as a defensive workaround, 
but the underlying mismatch remained.
   
   **Root cause:** `SedaConsumer.doStart()` creates `latch = new 
CountDownLatch(concurrentConsumers)`, but `ThreadPerTaskSedaConsumer` uses a 
single coordinator thread. When `concurrentConsumers > 1` (used as a 
concurrency limit, e.g., 2), the latch is initialized with count=2 but only 1 
coordinator thread ever calls `countDown()` — so `prepareShutdown()` always 
waits the full shutdown timeout before proceeding.
   
   **Fix:** Override `doStart()` in `ThreadPerTaskSedaConsumer` to set `latch = 
new CountDownLatch(1)`, matching the single coordinator thread. The 
`concurrentConsumers` value continues to serve as the task executor concurrency 
limit via the `Semaphore`. The task executor shutdown is handled separately in 
`ThreadPerTaskSedaConsumer.prepareShutdown()`.
   
   ### Changes
   - `SedaConsumer`: Change `latch` field visibility from `private` to 
`protected` so subclasses can override the count
   - `ThreadPerTaskSedaConsumer`: Override `doStart()` to set latch count to 1
   - `ThreadPerTaskSedaConsumerTest`: Add test verifying shutdown with 
concurrency limit completes quickly (no full timeout wait); apply JUnit 5 
conventions (drop `public`)
   
   ## Test plan
   
   - [x] Existing `ThreadPerTaskSedaConsumerTest` tests pass 
(virtualThreadPerTask basic, concurrency limit, high throughput)
   - [x] New `testShutdownWithConcurrencyLimitCompletesQuickly` verifies 
context stop completes in < 30s with `concurrentConsumers=2`
   - [ ] CI validation


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