-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Avoid notifying the removal listener for no-op replacements (fixes #593)
When a write operation replaces an entry's value with the same instance then a removal notification should not be published. Otherwise the listener may perform some cleanup work by incorrectly assuming that the value is no longer in the cache. That may be a resource being closed. We deviate from Guava in this regard which overlooked that case and our semantics are documented in the migration guide. Unfortunately there were cases when this suppression was not performed. When the entry is refreshed or if using an async cache then some cases might notify, while others would not. Note that an equal but different instance will be notified on as suppression is identity based. The additional tests uncovered a bug with the Map.entrySet()'s contains(o) method for weak/soft values. This used object equality, but should have used identity to be consistent for reference caching. This behavior now matches Guava.
- Loading branch information
Showing
20 changed files
with
709 additions
and
107 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.