--- jsr166/src/jsr166e/ConcurrentHashMapV8.java 2011/10/02 22:04:49 1.28
+++ jsr166/src/jsr166e/ConcurrentHashMapV8.java 2011/12/04 01:25:16 1.32
@@ -71,7 +71,7 @@ import java.io.Serializable;
* versions of this class, constructors may optionally specify an
* expected {@code concurrencyLevel} as an additional hint for
* internal sizing. Note that using many keys with exactly the same
- * {@code hashCode{}} is a sure way to slow down performance of any
+ * {@code hashCode()} is a sure way to slow down performance of any
* hash table.
*
*
This class and its views and iterators implement all of the
@@ -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)
@@ -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")
@@ -2187,7 +2187,7 @@ public class ConcurrentHashMapV8
return true;
}
- public final boolean removeAll(Collection c) {
+ public final boolean removeAll(Collection> c) {
boolean modified = false;
for (Iterator> it = iter(); it.hasNext();) {
if (c.contains(it.next())) {
@@ -2401,7 +2401,7 @@ public class ConcurrentHashMapV8
}
table = tab;
counter.add(size);
- sc = n - (n >>> 2) - 1;
+ sc = n - (n >>> 2);
}
} finally {
sizeCtl = sc;