Thursday, September 5, 2013

Explain the below lines of put(key,value) method of concurrentHashmap?

Explain the below lines of put(key,value) method of concurrentHashmap?

I was reading a implementation of inserting a key value pair in
ConcurrentHashMap here.
I am unable to understand the below lines.
int j = (hash >>> segmentShift) & segmentMask;
if ((s = (Segment<K,V>)UNSAFE.getObject // nonvolatile;
recheck
(segments, (j << SSHIFT) + SBASE)) == null) // in ensureSegment
s = ensureSegment(j);
return s.put(key, hash, value, false);
Somebody please explain.

No comments:

Post a Comment