ViewVC Help
View File | Revision Log | Show Annotations | Download File | Root Listing
root/jsr166/jsr166/src/main/java/util/concurrent/ConcurrentHashMap.java
(Generate patch)

Comparing jsr166/src/main/java/util/concurrent/ConcurrentHashMap.java (file contents):
Revision 1.149 by dl, Thu Dec 13 20:34:05 2012 UTC vs.
Revision 1.150 by jsr166, Fri Dec 14 16:33:42 2012 UTC

# Line 1263 | Line 1263 | public class ConcurrentHashMap<K, V>
1263              else {
1264                  boolean validated = false;
1265                  boolean deleted = false;
1266 <                synchronized(f) {
1266 >                synchronized (f) {
1267                      if (tabAt(tab, i) == f) {
1268                          validated = true;
1269                          for (Node e = f, pred = null;;) {
# Line 1364 | Line 1364 | public class ConcurrentHashMap<K, V>
1364                  return (V)fv;
1365              else {
1366                  Object oldVal = null;
1367 <                synchronized(f) {
1367 >                synchronized (f) {
1368                      if (tabAt(tab, i) == f) {
1369                          len = 1;
1370                          for (Node e = f;; ++len) {
# Line 1412 | Line 1412 | public class ConcurrentHashMap<K, V>
1412                  tab = initTable();
1413              else if ((f = tabAt(tab, i = (tab.length - 1) & h)) == null) {
1414                  Node node = new Node(h, k, null, null);
1415 <                synchronized(node) {
1415 >                synchronized (node) {
1416                      if (casTabAt(tab, i, null, node)) {
1417                          len = 1;
1418                          try {
# Line 1464 | Line 1464 | public class ConcurrentHashMap<K, V>
1464                          return (V)ev;
1465                  }
1466                  boolean added = false;
1467 <                synchronized(f) {
1467 >                synchronized (f) {
1468                      if (tabAt(tab, i) == f) {
1469                          len = 1;
1470                          for (Node e = f;; ++len) {
# Line 1518 | Line 1518 | public class ConcurrentHashMap<K, V>
1518                  if (onlyIfPresent)
1519                      break;
1520                  Node node = new Node(h, k, null, null);
1521 <                synchronized(node) {
1521 >                synchronized (node) {
1522                      if (casTabAt(tab, i, null, node)) {
1523                          try {
1524                              len = 1;
# Line 1570 | Line 1570 | public class ConcurrentHashMap<K, V>
1570                      tab = (Node[])fk;
1571              }
1572              else {
1573 <                synchronized(f) {
1573 >                synchronized (f) {
1574                      if (tabAt(tab, i) == f) {
1575                          len = 1;
1576                          for (Node e = f, pred = null;; ++len) {
# Line 1667 | Line 1667 | public class ConcurrentHashMap<K, V>
1667                      tab = (Node[])fk;
1668              }
1669              else {
1670 <                synchronized(f) {
1670 >                synchronized (f) {
1671                      if (tabAt(tab, i) == f) {
1672                          len = 1;
1673                          for (Node e = f, pred = null;; ++len) {
# Line 1760 | Line 1760 | public class ConcurrentHashMap<K, V>
1760                      }
1761                      else {
1762                          int len = 0;
1763 <                        synchronized(f) {
1763 >                        synchronized (f) {
1764                              if (tabAt(tab, i) == f) {
1765                                  len = 1;
1766                                  for (Node e = f;; ++len) {
# Line 1835 | Line 1835 | public class ConcurrentHashMap<K, V>
1835                      tab = (Node[])fk;
1836              }
1837              else {
1838 <                synchronized(f) {
1838 >                synchronized (f) {
1839                      if (tabAt(tab, i) == f) {
1840                          for (Node e = f; e != null; e = e.next) {
1841                              if (e.val != null) {  // (currently always true)
# Line 1982 | Line 1982 | public class ConcurrentHashMap<K, V>
1982          if (nextTab == null) {            // initiating
1983              try {
1984                  nextTab = new Node[n << 1];
1985 <            } catch(Throwable ex) {       // try to cope with OOME
1985 >            } catch (Throwable ex) {      // try to cope with OOME
1986                  sizeCtl = Integer.MAX_VALUE;
1987                  return;
1988              }
# Line 1991 | Line 1991 | public class ConcurrentHashMap<K, V>
1991              transferIndex = n;
1992              Node rev = new Node(MOVED, tab, null, null);
1993              for (int k = n; k > 0;) {    // progressively reveal ready slots
1994 <                int nextk = k > stride? k - stride : 0;
1994 >                int nextk = (k > stride) ? k - stride : 0;
1995                  for (int m = nextk; m < k; ++m)
1996                      nextTab[m] = rev;
1997                  for (int m = n + nextk; m < n + k; ++m)
# Line 2013 | Line 2013 | public class ConcurrentHashMap<K, V>
2013                  }
2014                  else if (U.compareAndSwapInt
2015                           (this, TRANSFERINDEX, nextIndex,
2016 <                          nextBound = (nextIndex > stride?
2016 >                          nextBound = (nextIndex > stride ?
2017                                         nextIndex - stride : 0))) {
2018                      bound = nextBound;
2019                      i = nextIndex - 1;
# Line 2040 | Line 2040 | public class ConcurrentHashMap<K, V>
2040                  }
2041              }
2042              else if (f.hash >= 0) {
2043 <                synchronized(f) {
2043 >                synchronized (f) {
2044                      if (tabAt(tab, i) == f) {
2045                          int runBit = f.hash & n;
2046                          Node lastRun = f, lo = null, hi = null;

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines