[rfc][icedtea-web] CacheLRUWrapper SortedEntries Fix

Jie Kang jkang at redhat.com
Thu Sep 11 15:12:11 UTC 2014


When messing around with CacheUtil::cleanCache related to [1] , I discovered an issue with the LRU entries having unnecessary duplicates.

[1] http://mail.openjdk.java.net/pipermail/distro-pkg-dev/2014-August/029280.html : in particular, Omair's comments asking why the keep HashSet and conditionals were needed. When removing 'keep', duplicates remained in the LRU (but the underlying problem is that there are duplicates at all, which is what this fix is for)

After some tinkering I have confirmed that the code dealing with LRU entries is mostly correct except for the function clearLRUSortedEntries. This patch fixes the bug by making said function return a "deeper" copy of the entries. Updates to the map wearere being performed while iterating over the list returned by clearLRUSortedEntries. It seems that though 'new ArrayList(Set)' was used, inconsistencies still appeared when iterating and updating the map. This may or may not be related to [2] which was the impetus for my change. The change removes the occurrence of inconsistencies in the LRU.

[2] http://maxrohde.com/2014/01/14/copy-entryset-of-a-hashmap-in-java/

Thoughts? Okay to push?



Jie Kang
-------------- next part --------------
A non-text attachment was scrubbed...
Name: itw-cachelru-duplicate-fix-1.patch
Type: text/x-patch
Size: 1087 bytes
Desc: not available
URL: <http://mail.openjdk.java.net/pipermail/distro-pkg-dev/attachments/20140911/6d308b6a/itw-cachelru-duplicate-fix-1.patch>

More information about the distro-pkg-dev mailing list