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

Comparing jsr166/src/main/java/util/concurrent/PriorityBlockingQueue.java (file contents):
Revision 1.107 by jsr166, Sun Jan 4 01:06:15 2015 UTC vs.
Revision 1.108 by jsr166, Sun Jan 4 09:15:11 2015 UTC

# Line 260 | Line 260 | public class PriorityBlockingQueue<E> ex
260          lock.unlock(); // must release and then re-acquire main lock
261          Object[] newArray = null;
262          if (allocationSpinLock == 0 &&
263 <            UNSAFE.compareAndSwapInt(this, allocationSpinLockOffset,
264 <                                     0, 1)) {
263 >            U.compareAndSwapInt(this, ALLOCATIONSPINLOCK, 0, 1)) {
264              try {
265                  int newCap = oldCap + ((oldCap < 64) ?
266                                         (oldCap + 2) : // grow faster if small
# Line 999 | Line 998 | public class PriorityBlockingQueue<E> ex
998      }
999  
1000      // Unsafe mechanics
1001 <    private static final sun.misc.Unsafe UNSAFE;
1002 <    private static final long allocationSpinLockOffset;
1001 >    private static final sun.misc.Unsafe U = sun.misc.Unsafe.getUnsafe();
1002 >    private static final long ALLOCATIONSPINLOCK;
1003      static {
1004          try {
1005 <            UNSAFE = sun.misc.Unsafe.getUnsafe();
1006 <            Class<?> k = PriorityBlockingQueue.class;
1008 <            allocationSpinLockOffset = UNSAFE.objectFieldOffset
1009 <                (k.getDeclaredField("allocationSpinLock"));
1005 >            ALLOCATIONSPINLOCK = U.objectFieldOffset
1006 >                (PriorityBlockingQueue.class.getDeclaredField("allocationSpinLock"));
1007          } catch (ReflectiveOperationException e) {
1008              throw new Error(e);
1009          }

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines