rt/emul/compact/src/main/java/java/util/concurrent/PriorityBlockingQueue.java
changeset 1895 bfaf3300b7ba
parent 1890 212417b74b72
     1.1 --- a/rt/emul/compact/src/main/java/java/util/concurrent/PriorityBlockingQueue.java	Sat Mar 19 10:46:31 2016 +0100
     1.2 +++ b/rt/emul/compact/src/main/java/java/util/concurrent/PriorityBlockingQueue.java	Sat Mar 19 12:51:03 2016 +0100
     1.3 @@ -276,9 +276,8 @@
     1.4      private void tryGrow(Object[] array, int oldCap) {
     1.5          lock.unlock(); // must release and then re-acquire main lock
     1.6          Object[] newArray = null;
     1.7 -        if (allocationSpinLock == 0 &&
     1.8 -            UNSAFE.compareAndSwapInt(this, allocationSpinLockOffset,
     1.9 -                                     0, 1)) {
    1.10 +        if (allocationSpinLock == 0) {
    1.11 +            allocationSpinLock = 1;
    1.12              try {
    1.13                  int newCap = oldCap + ((oldCap < 64) ?
    1.14                                         (oldCap + 2) : // grow faster if small
    1.15 @@ -961,18 +960,4 @@
    1.16              q = null;
    1.17          }
    1.18      }
    1.19 -
    1.20 -    // Unsafe mechanics
    1.21 -    private static final sun.misc.Unsafe UNSAFE;
    1.22 -    private static final long allocationSpinLockOffset;
    1.23 -    static {
    1.24 -        try {
    1.25 -            UNSAFE = sun.misc.Unsafe.getUnsafe();
    1.26 -            Class k = PriorityBlockingQueue.class;
    1.27 -            allocationSpinLockOffset = UNSAFE.objectFieldOffset
    1.28 -                (k.getDeclaredField("allocationSpinLock"));
    1.29 -        } catch (Exception e) {
    1.30 -            throw new Error(e);
    1.31 -        }
    1.32 -    }
    1.33  }