ConcurrentHashMap serialization fix

Chris Hegarty chris.hegarty at
Fri Apr 26 06:58:38 PDT 2013

Hi Doug, Peter,

I did notice the change in serial form of CHMv8 when looking at another 
issue. While the addition of serialPersistentFields containing 
"segments" is welcome, there is still a change in serial form 7 to 
CHMv8. Both "int segmentMask" and "int segmentShift" are part of the 7 
serial form.

We can either add them to the new serialPersistentFields in CHMv8, or 
request that they be removed from the serial form in JDK8.


On 25/04/2013 17:17, Doug Lea wrote:
> On 04/25/13 10:47, Peter Levart wrote:
>> Hello,
>> The fix adds back "extends
>> ReentrantLock" to CHM.Segment to fix the serialization format of new CHM.
> Thanks! I don't know how that went away.
>> The fix gets rid of CHM.segments field and uses serialPersistentFields
>> array to simulate the field and changes the writeObject to use local
>> instance of segments array for populating the stream.
> Even better. I'm always hesitant about creating serial fields,
> but should have done it this way to begin with.
> I committed (with some trivial changes) to our jsr166 version,
> so we can include when sync'ing up with main tl branch.
> -Doug

More information about the lambda-dev mailing list