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

   Backport of #24717 to `camel-4.14.x`.
   
   Fixes [CAMEL-24080](https://issues.apache.org/jira/browse/CAMEL-24080) on 
the 4.14.x line.
   
   The Kinesis consumer's shard state (`currentShardIterators`, `warnLogged`) 
is written concurrently from `poll()`'s `parallelStream()`; it was a plain 
`HashMap`/`HashSet`, and the poll count used `getAndSet` (plus a `set(0)` 
reset), so parallel shards overwrote each other. This uses `ConcurrentHashMap` 
/ `ConcurrentHashMap.newKeySet()` and accumulates with `addAndGet()`. A 
sentinel (empty string) replaces the previous `null` closed-shard marker, since 
`ConcurrentHashMap` forbids null values.
   
   Backport adaptations beyond the cherry-pick (this branch predates some main 
cleanups):
   - maintenance-branch import style (FQCN `java.util.HashMap`);
   - the closed-shard guard in `poll()` used `shardIterator == null`;
   - **`getShardIterator` also detected a closed shard with `get(shardId) == 
null`** — updated to `ObjectHelper.isEmpty(...)` so the empty-string sentinel 
is still recognised (otherwise the `fail` shard-closed strategy would stop 
throwing).
   
   `KinesisConsumerMultiShardTest` and the existing 
`ClosedShardWith{Fail,Silent}` tests pass on this branch.
   
   ---
   _Claude Code on behalf of oscerd_


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