< prev index next >

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

Print this page




 156 
 157     /**
 158      * The number of elements in the priority queue.
 159      */
 160     private transient int size;
 161 
 162     /**
 163      * The comparator, or null if priority queue uses elements'
 164      * natural ordering.
 165      */
 166     private transient Comparator<? super E> comparator;
 167 
 168     /**
 169      * Lock used for all public operations.
 170      */
 171     private final ReentrantLock lock = new ReentrantLock();
 172 
 173     /**
 174      * Condition for blocking when empty.
 175      */

 176     private final Condition notEmpty = lock.newCondition();
 177 
 178     /**
 179      * Spinlock for allocation, acquired via CAS.
 180      */
 181     private transient volatile int allocationSpinLock;
 182 
 183     /**
 184      * A plain PriorityQueue used only for serialization,
 185      * to maintain compatibility with previous versions
 186      * of this class. Non-null only during serialization/deserialization.
 187      */
 188     private PriorityQueue<E> q;
 189 
 190     /**
 191      * Creates a {@code PriorityBlockingQueue} with the default
 192      * initial capacity (11) that orders its elements according to
 193      * their {@linkplain Comparable natural ordering}.
 194      */
 195     public PriorityBlockingQueue() {




 156 
 157     /**
 158      * The number of elements in the priority queue.
 159      */
 160     private transient int size;
 161 
 162     /**
 163      * The comparator, or null if priority queue uses elements'
 164      * natural ordering.
 165      */
 166     private transient Comparator<? super E> comparator;
 167 
 168     /**
 169      * Lock used for all public operations.
 170      */
 171     private final ReentrantLock lock = new ReentrantLock();
 172 
 173     /**
 174      * Condition for blocking when empty.
 175      */
 176     @SuppressWarnings("serial") // Not statically typed as Serializable
 177     private final Condition notEmpty = lock.newCondition();
 178 
 179     /**
 180      * Spinlock for allocation, acquired via CAS.
 181      */
 182     private transient volatile int allocationSpinLock;
 183 
 184     /**
 185      * A plain PriorityQueue used only for serialization,
 186      * to maintain compatibility with previous versions
 187      * of this class. Non-null only during serialization/deserialization.
 188      */
 189     private PriorityQueue<E> q;
 190 
 191     /**
 192      * Creates a {@code PriorityBlockingQueue} with the default
 193      * initial capacity (11) that orders its elements according to
 194      * their {@linkplain Comparable natural ordering}.
 195      */
 196     public PriorityBlockingQueue() {


< prev index next >