s8sankalp opened a new pull request, #694: URL: https://github.com/apache/commons-collections/pull/694
## Description When `PassiveExpiringMap` is decorated with `Collections.synchronizedMap()`, calling view methods like `entrySet()`, `keySet()`, or `values()` returns cached view decorators managed by `SynchronizedMap`. This bypasses `PassiveExpiringMap`'s view methods and avoids triggering the passive eviction logic `removeAllExpired()` during iteration, resulting in expired entries remaining in the map indefinitely. This PR introduces custom collection views (`EntrySet`, `KeySet`, `ValuesCollection`) and their respective iterators to: 1. Ensure `removeAllExpired()` is triggered on all read and write collection view operations. 2. Propagate iterator `remove()` actions to the map's internal `expirationMap`. 3. Preserve the O(1) complexity of `remove()` and `removeAll()` for the set views. ## Verification - Added JUnit regression test `testCollectionsSynchronizedMapExpiration()` verifying correct passive eviction when iterating/accessing collection views of a synchronized `PassiveExpiringMap`. - Added JUnit regression test `testCollectionViewRemoval()` verifying correct cleanup of `expirationMap` when elements are removed via view iterators. - All unit tests pass successfully. -- 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]
