--- jsr166/src/jsr166e/ConcurrentHashMapV8.java 2011/10/02 22:01:06 1.27 +++ jsr166/src/jsr166e/ConcurrentHashMapV8.java 2011/10/09 19:57:49 1.30 @@ -391,7 +391,7 @@ public class ConcurrentHashMapV8 /** * Key-value entry. Note that this is never exported out as a * user-visible Map.Entry (see WriteThroughEntry and SnapshotEntry - * below). Nodes with a negative hash field are special, and do + * below). Nodes with a hash field of MOVED are special, and do * not contain user keys or values. Otherwise, keys are never * null, and null val fields indicate that a node is in the * process of being deleted or created. For purposes of read-only @@ -595,7 +595,7 @@ public class ConcurrentHashMapV8 } finally { if (!f.casHash(fh | LOCKED, fh)) { f.hash = fh; - synchronized(f) { f.notifyAll(); }; + synchronized (f) { f.notifyAll(); }; } } if (validated) { @@ -752,7 +752,7 @@ public class ConcurrentHashMapV8 } finally { if (!f.casHash(fh | LOCKED, fh)) { f.hash = fh; - synchronized(f) { f.notifyAll(); }; + synchronized (f) { f.notifyAll(); }; } } if (validated) { @@ -789,7 +789,7 @@ public class ConcurrentHashMapV8 setTabAt(tab, i, null); if (!node.casHash(fh, h)) { node.hash = h; - synchronized(node) { node.notifyAll(); }; + synchronized (node) { node.notifyAll(); }; } } } @@ -843,7 +843,7 @@ public class ConcurrentHashMapV8 } finally { if (!f.casHash(fh | LOCKED, fh)) { f.hash = fh; - synchronized(f) { f.notifyAll(); }; + synchronized (f) { f.notifyAll(); }; } } if (validated) @@ -934,13 +934,13 @@ public class ConcurrentHashMapV8 break; } } + if (val == null) + throw new NullPointerException(); if (added) { counter.add(1L); if (checkSize) checkForResize(); } - else if (val == null) - throw new NullPointerException(); return val; } @@ -1002,7 +1002,7 @@ public class ConcurrentHashMapV8 } finally { if (!f.casHash(fh | LOCKED, fh)) { f.hash = fh; - synchronized(f) { f.notifyAll(); }; + synchronized (f) { f.notifyAll(); }; } } if (validated) { @@ -1099,7 +1099,7 @@ public class ConcurrentHashMapV8 while ((sc = sizeCtl) >= 0) { Node[] tab = table; int n; if (tab == null || (n = tab.length) == 0) { - n = (sc > c)? sc : c; + n = (sc > c) ? sc : c; if (UNSAFE.compareAndSwapInt(this, sizeCtlOffset, sc, -1)) { try { if (table == tab) { @@ -1271,7 +1271,7 @@ public class ConcurrentHashMapV8 } finally { if (!f.casHash(fh | LOCKED, fh)) { f.hash = fh; - synchronized(f) { f.notifyAll(); }; + synchronized (f) { f.notifyAll(); }; } } if (validated) @@ -1678,7 +1678,7 @@ public class ConcurrentHashMapV8 * final String msg = ...; * map.compute(key, new RemappingFunction() { * public String remap(Key k, String v) { - * return (v == null) ? msg : v + msg;});} + * return (v == null) ? msg : v + msg;});}} * * @param key key with which the specified value is to be associated * @param remappingFunction the function to compute a value @@ -1689,7 +1689,7 @@ public class ConcurrentHashMapV8 * @throws IllegalStateException if the computation detectably * attempts a recursive update to this map that would * otherwise never complete - * @throws RuntimeException or Error if the mappingFunction does so, + * @throws RuntimeException or Error if the remappingFunction does so, * in which case the mapping is unchanged */ @SuppressWarnings("unchecked") @@ -2401,7 +2401,7 @@ public class ConcurrentHashMapV8 } table = tab; counter.add(size); - sc = n - (n >>> 2) - 1; + sc = n - (n >>> 2); } } finally { sizeCtl = sc;