allthingssecurity commented on PR #30310: URL: https://github.com/apache/camel/pull/30310#issuecomment-6973292974
Thanks Claus, you are right, the stop must not cut off the exchange that is being routed. Fixed in d6d96a0, along the lines you suggested: `OperationsExecutor` has a lock and a `processing` flag. `stop()` sets `stopped` and interrupts the thread only when it is not routing an exchange (so it still ends the wait in `operations.take()` or on a watch). Before an exchange is routed the thread checks `stopped` under the same lock, and after it the existing `isRunning()` checks end the loop. I used a `ReentrantLock` rather than `synchronized`, as elsewhere in Camel. `stopDoesNotInterruptTheExchangeBeingRouted` routes an exchange that blocks on a latch, stops the route from another thread, waits until the consumer is stopped, then releases the latch: the exchange must complete without being interrupted. Without the change it gets an `InterruptedException`. Nit: `operationsThreads()` (and `operationsThreadWaitsForAChange()`) now only count threads with `(<context name>)` in their name. Targeted runs: the camel-zookeeper tests pass (31 run, 0 failures), and `ZooKeeperConsumerRestartTest` passes 10 times in one JVM (20/20). With the main file reverted, the new test fails with the `InterruptedException`. _Claude Code on behalf of allthingssecurity_ -- 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]
