--- old/src/java.base/share/classes/java/util/concurrent/PriorityBlockingQueue.java 2021-01-09 11:35:32.985118215 -0800 +++ new/src/java.base/share/classes/java/util/concurrent/PriorityBlockingQueue.java 2021-01-09 11:35:32.677120638 -0800 @@ -87,7 +87,7 @@ *
{@code * class FIFOEntry> * implements Comparable > { - * static final AtomicLong seq = new AtomicLong(0); + * static final AtomicLong seq = new AtomicLong(); * final long seqNum; * final E entry; * public FIFOEntry(E entry) { @@ -226,7 +226,7 @@ /** * Creates a {@code PriorityBlockingQueue} containing the elements * in the specified collection. If the specified collection is a - * {@link SortedSet} or a {@link PriorityQueue}, this + * {@link SortedSet} or a {@link PriorityBlockingQueue}, this * priority queue will be ordered according to the same ordering. * Otherwise, this priority queue will be ordered according to the * {@linkplain Comparable natural ordering} of its elements. @@ -290,7 +290,9 @@ if (allocationSpinLock == 0 && ALLOCATIONSPINLOCK.compareAndSet(this, 0, 1)) { try { - int growth = oldCap < 64 ? oldCap + 2 : oldCap >> 1; + 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];