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

   ## Summary
   
   _Claude Code on behalf of davsclaus_
   
   Fixes three correctness bugs in `SingleNodeKafkaResumeStrategy`:
   
   - **Double subscribe replaces rebalance listener**: `refresh()` called 
`subscribe(consumer)` (which registers a `ConsumerRebalanceListener` via 
`checkAndSubscribe`), then immediately called `consumer.subscribe()` again 
without the listener, replacing the subscription. Removed the redundant second 
subscribe call.
   - **`getAdapter()` never waits for initialization**: the condition `adapter 
== null` was never true because `setAdapter()` is always called before 
`loadCache()`. Changed to check `initLatch != null` instead, so callers block 
until cache loading completes.
   - **`stop()` throws `IllegalMonitorStateException`**: `writeLock.tryLock()` 
can return false, but the `finally` block always called `writeLock.unlock()`. 
Added `isHeldByCurrentThread()` guard before unlocking.
   
   Also adds `SingleNodeKafkaResumeStrategyTest` with unit tests for the fixed 
behaviors.
   
   ## Test plan
   
   - [x] New `SingleNodeKafkaResumeStrategyTest` (3 tests) — all pass
   - [x] All 149 existing `camel-kafka` tests pass with no regressions
   
   🤖 Generated with [Claude Code](https://claude.com/claude-code)


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