< prev index next >

src/java.base/share/classes/java/util/concurrent/PriorityBlockingQueue.java

Print this page
8234131: Miscellaneous changes imported from jsr166 CVS 2020-06
Reviewed-by: martin

*** 85,95 **** * {@code new FIFOEntry(anEntry)} instead of a plain entry object. * * <pre> {@code * class FIFOEntry<E extends Comparable<? super E>> * implements Comparable<FIFOEntry<E>> { ! * static final AtomicLong seq = new AtomicLong(0); * final long seqNum; * final E entry; * public FIFOEntry(E entry) { * seqNum = seq.getAndIncrement(); * this.entry = entry; --- 85,95 ---- * {@code new FIFOEntry(anEntry)} instead of a plain entry object. * * <pre> {@code * class FIFOEntry<E extends Comparable<? super E>> * implements Comparable<FIFOEntry<E>> { ! * static final AtomicLong seq = new AtomicLong(); * final long seqNum; * final E entry; * public FIFOEntry(E entry) { * seqNum = seq.getAndIncrement(); * this.entry = entry;
*** 288,298 **** lock.unlock(); // must release and then re-acquire main lock Object[] newArray = null; if (allocationSpinLock == 0 && ALLOCATIONSPINLOCK.compareAndSet(this, 0, 1)) { try { ! int growth = oldCap < 64 ? oldCap + 2 : oldCap >> 1; int newCap = ArraysSupport.newLength(oldCap, 1, growth); if (queue == array) newArray = new Object[newCap]; } finally { allocationSpinLock = 0; --- 288,300 ---- lock.unlock(); // must release and then re-acquire main lock Object[] newArray = null; if (allocationSpinLock == 0 && ALLOCATIONSPINLOCK.compareAndSet(this, 0, 1)) { try { ! int growth = (oldCap < 64) ! ? (oldCap + 2) // grow faster if small ! : (oldCap >> 1); int newCap = ArraysSupport.newLength(oldCap, 1, growth); if (queue == array) newArray = new Object[newCap]; } finally { allocationSpinLock = 0;
< prev index next >