Closed GoogleCodeExporter closed 9 years ago
Looks like I forgot to override keySet() to delegate to CHM's method. The
AbstractMap retrieves them in an inefficient, but generic manner.
The node within the CHM should never be null. The entry should be removed, the
node's value null'd out for GC, and the linkage lazily cleaned up. I need to
investigate this and duplicate in my unit tests.
Original comment by Ben.Manes@gmail.com
on 26 Feb 2009 at 2:08
While nulling out the value occurs after that entry is removed, I did not
consider
the effect of concurrent removals. Since readers see a snapshot of the entry
set in
the CHM's segment, a subsequent removal does not drop the entry from the links
seen
by previous readers. This means that when I remove the entry and null out the
value
to mark it as dead, other readers will see the change. I had forgotten the core
design idea behind CHM!
This is fairly easy to fix for entrySet()/values(). The iterator can simply
skip
ahead and peek at the next valid entry. For keySet(), the CHM's should just be
returned, as no unwrapping of the value is needed.
Original comment by Ben.Manes@gmail.com
on 27 Feb 2009 at 5:28
Original comment by Ben.Manes@gmail.com
on 1 Mar 2009 at 8:58
Resolved in CL-206.
Original comment by Ben.Manes@gmail.com
on 7 Mar 2009 at 8:32
Original comment by Ben.Manes@gmail.com
on 7 Mar 2009 at 8:38
Original comment by Ben.Manes@gmail.com
on 7 Mar 2009 at 8:38
Original issue reported on code.google.com by
Ben.Manes@gmail.com
on 26 Feb 2009 at 2:04