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.257 by jsr166, Tue Jun 3 23:49:57 2014 UTC vs.
Revision 1.261 by jsr166, Wed Dec 31 09:37:20 2014 UTC

# Line 13 | Line 13 | import java.lang.reflect.Type;
13   import java.util.AbstractMap;
14   import java.util.Arrays;
15   import java.util.Collection;
16 import java.util.Comparator;
16   import java.util.Enumeration;
17   import java.util.HashMap;
18   import java.util.Hashtable;
# Line 22 | Line 21 | import java.util.Map;
21   import java.util.NoSuchElementException;
22   import java.util.Set;
23   import java.util.Spliterator;
25 import java.util.concurrent.ConcurrentMap;
26 import java.util.concurrent.ForkJoinPool;
24   import java.util.concurrent.atomic.AtomicReference;
25   import java.util.concurrent.locks.LockSupport;
26   import java.util.concurrent.locks.ReentrantLock;
27   import java.util.function.BiConsumer;
28   import java.util.function.BiFunction;
32 import java.util.function.BinaryOperator;
29   import java.util.function.Consumer;
30   import java.util.function.DoubleBinaryOperator;
31   import java.util.function.Function;
# Line 1027 | Line 1023 | public class ConcurrentHashMap<K,V> exte
1023                                      p.val = value;
1024                              }
1025                          }
1026 +                        else if (f instanceof ReservationNode)
1027 +                            throw new IllegalStateException("Recursive update");
1028                      }
1029                  }
1030                  if (binCount != 0) {
# Line 1129 | Line 1127 | public class ConcurrentHashMap<K,V> exte
1127                                  }
1128                              }
1129                          }
1130 +                        else if (f instanceof ReservationNode)
1131 +                            throw new IllegalStateException("Recursive update");
1132                      }
1133                  }
1134                  if (validated) {
# Line 1657 | Line 1657 | public class ConcurrentHashMap<K,V> exte
1657                                  Node<K,V> pred = e;
1658                                  if ((e = e.next) == null) {
1659                                      if ((val = mappingFunction.apply(key)) != null) {
1660 +                                        if (pred.next != null)
1661 +                                            throw new IllegalStateException("Recursive update");
1662                                          added = true;
1663                                          pred.next = new Node<K,V>(h, key, val, null);
1664                                      }
# Line 1676 | Line 1678 | public class ConcurrentHashMap<K,V> exte
1678                                  t.putTreeVal(h, key, val);
1679                              }
1680                          }
1681 +                        else if (f instanceof ReservationNode)
1682 +                            throw new IllegalStateException("Recursive update");
1683                      }
1684                  }
1685                  if (binCount != 0) {
# Line 1771 | Line 1775 | public class ConcurrentHashMap<K,V> exte
1775                                  }
1776                              }
1777                          }
1778 +                        else if (f instanceof ReservationNode)
1779 +                            throw new IllegalStateException("Recursive update");
1780                      }
1781                  }
1782                  if (binCount != 0)
# Line 1862 | Line 1868 | public class ConcurrentHashMap<K,V> exte
1868                                  if ((e = e.next) == null) {
1869                                      val = remappingFunction.apply(key, null);
1870                                      if (val != null) {
1871 +                                        if (pred.next != null)
1872 +                                            throw new IllegalStateException("Recursive update");
1873                                          delta = 1;
1874                                          pred.next =
1875                                              new Node<K,V>(h, key, val, null);
# Line 1894 | Line 1902 | public class ConcurrentHashMap<K,V> exte
1902                                      setTabAt(tab, i, untreeify(t.first));
1903                              }
1904                          }
1905 +                        else if (f instanceof ReservationNode)
1906 +                            throw new IllegalStateException("Recursive update");
1907                      }
1908                  }
1909                  if (binCount != 0) {
# Line 2003 | Line 2013 | public class ConcurrentHashMap<K,V> exte
2013                                      setTabAt(tab, i, untreeify(t.first));
2014                              }
2015                          }
2016 +                        else if (f instanceof ReservationNode)
2017 +                            throw new IllegalStateException("Recursive update");
2018                      }
2019                  }
2020                  if (binCount != 0) {
# Line 2318 | Line 2330 | public class ConcurrentHashMap<K,V> exte
2330                  break;
2331              else if (tab == table) {
2332                  int rs = resizeStamp(n);
2333 <                if (sc < 0) {
2334 <                    Node<K,V>[] nt;
2323 <                    if ((sc >>> RESIZE_STAMP_SHIFT) != rs || sc == rs + 1 ||
2324 <                        sc == rs + MAX_RESIZERS || (nt = nextTable) == null ||
2325 <                        transferIndex <= 0)
2326 <                        break;
2327 <                    if (U.compareAndSwapInt(this, SIZECTL, sc, sc + 1))
2328 <                        transfer(tab, nt);
2329 <                }
2330 <                else if (U.compareAndSwapInt(this, SIZECTL, sc,
2331 <                                             (rs << RESIZE_STAMP_SHIFT) + 2))
2333 >                if (U.compareAndSwapInt(this, SIZECTL, sc,
2334 >                                        (rs << RESIZE_STAMP_SHIFT) + 2))
2335                      transfer(tab, null);
2336              }
2337          }
# Line 2746 | Line 2749 | public class ConcurrentHashMap<K,V> exte
2749                                    (kc = comparableClassFor(k)) == null) ||
2750                                   (dir = compareComparables(kc, k, pk)) == 0)
2751                              dir = tieBreakOrder(k, pk);
2752 <                            TreeNode<K,V> xp = p;
2752 >                        TreeNode<K,V> xp = p;
2753                          if ((p = (dir <= 0) ? p.left : p.right) == null) {
2754                              x.parent = xp;
2755                              if (dir <= 0)

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines