Queue blocking queue PriorityBlockingQueue

PriorityBlockingQueue prioritized unbounded blocking queue

 

Package Penalty for com.dh.learn.queue; 

Import java.util.concurrent.BlockingQueue;
 Import java.util.concurrent.PriorityBlockingQueue; 

public  class LearnPriorityBlockingQueue {
     // PriorityBlockingQueue is on the basis of PriorityQueue, adding ReentrantLock and Condition achieve a blocking 

    / / a PriorityBlockingQueue is has priority and unbounded 

    // because the queue is unbounded, it is not blocked (automatic expansion) when the additive element is present. Only the queue is empty, when an element taken from the queue, will clog 

    // underlying data structures are: a sequential array of arrays: a small top of the stack (the root node are child nodes is smaller than two) 

    public  static  void main (String [] args ) {
         // can specify the size of the initial capacity and a comparator 
        BlockingQueue <String> = PriorityBlockingQueue new new a PriorityBlockingQueue is <>();


    }
}

 

Guess you like

Origin www.cnblogs.com/han6/p/11275554.html