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.111 by jsr166, Thu Apr 28 00:15:06 2011 UTC vs.
Revision 1.112 by jsr166, Fri Jun 3 02:28:05 2011 UTC

# Line 199 | Line 199 | public class ConcurrentHashMap<K, V> ext
199          static {
200              try {
201                  UNSAFE = sun.misc.Unsafe.getUnsafe();
202 <                Class k = HashEntry.class;
202 >                Class<?> k = HashEntry.class;
203                  nextOffset = UNSAFE.objectFieldOffset
204                      (k.getDeclaredField("next"));
205              } catch (Exception e) {
# Line 404 | Line 404 | public class ConcurrentHashMap<K, V> ext
404              int newCapacity = oldCapacity << 1;
405              threshold = (int)(newCapacity * loadFactor);
406              HashEntry<K,V>[] newTable =
407 <                (HashEntry<K,V>[]) new HashEntry[newCapacity];
407 >                (HashEntry<K,V>[]) new HashEntry<?,?>[newCapacity];
408              int sizeMask = newCapacity - 1;
409              for (int i = 0; i < oldCapacity ; i++) {
410                  HashEntry<K,V> e = oldTable[i];
# Line 648 | Line 648 | public class ConcurrentHashMap<K, V> ext
648              int cap = proto.table.length;
649              float lf = proto.loadFactor;
650              int threshold = (int)(cap * lf);
651 <            HashEntry<K,V>[] tab = (HashEntry<K,V>[])new HashEntry[cap];
651 >            HashEntry<K,V>[] tab = (HashEntry<K,V>[])new HashEntry<?,?>[cap];
652              if ((seg = (Segment<K,V>)UNSAFE.getObjectVolatile(ss, u))
653                  == null) { // recheck
654                  Segment<K,V> s = new Segment<K,V>(lf, threshold, tab);
# Line 729 | Line 729 | public class ConcurrentHashMap<K, V> ext
729          // create segments and segments[0]
730          Segment<K,V> s0 =
731              new Segment<K,V>(loadFactor, (int)(cap * loadFactor),
732 <                             (HashEntry<K,V>[])new HashEntry[cap]);
733 <        Segment<K,V>[] ss = (Segment<K,V>[])new Segment[ssize];
732 >                             (HashEntry<K,V>[])new HashEntry<?,?>[cap]);
733 >        Segment<K,V>[] ss = (Segment<K,V>[])new Segment<?,?>[ssize];
734          UNSAFE.putOrderedObject(ss, SBASE, s0); // ordered write of segments[0]
735          this.segments = ss;
736      }
# Line 1441 | Line 1441 | public class ConcurrentHashMap<K, V> ext
1441              Segment<K,V> seg = segments[k];
1442              if (seg != null) {
1443                  seg.threshold = (int)(cap * seg.loadFactor);
1444 <                seg.table = (HashEntry<K,V>[]) new HashEntry[cap];
1444 >                seg.table = (HashEntry<K,V>[]) new HashEntry<?,?>[cap];
1445              }
1446          }
1447  
# Line 1466 | Line 1466 | public class ConcurrentHashMap<K, V> ext
1466          int ss, ts;
1467          try {
1468              UNSAFE = sun.misc.Unsafe.getUnsafe();
1469 <            Class tc = HashEntry[].class;
1470 <            Class sc = Segment[].class;
1469 >            Class<?> tc = HashEntry[].class;
1470 >            Class<?> sc = Segment[].class;
1471              TBASE = UNSAFE.arrayBaseOffset(tc);
1472              SBASE = UNSAFE.arrayBaseOffset(sc);
1473              ts = UNSAFE.arrayIndexScale(tc);

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines