A brief description of the difference between a queue of several Java

Foreword

  Queue, literally can understand. Is a linear data staging and management tools can also make a variety of business functions run queue one by one. Java on this blog only explain several queues

Non-blocking and blocking queue of difference

  Not blocked:

    1. unblocked concurrent queue when the queue would like to add or to obtain data, certainly there will only be a success, others may be added.

  Obstruction:

    1. The queue will be blocked thread blocking operation, so that concurrent or add data to obtain a degree of delay can be added to ensure that a large number of concurrent data, but also a blocking timeout .. After more than a period of time will still throw an exception or throw false

 

Does not implement blocking interface

Achieve LinkList java.util.Queue and
implement java.util.AbstractQueue interfaces built without blocking queue: PriorityQueue and ConcurrentLinkedQueue

Realization of the blocking interface

java.util.concurrent BlockingQueue added to five blocking queue class and interfaces. It is essentially a FIFO data structure with little distortion. Not immediately add or remove elements from the queue, the thread perform the operation block until there is space available or elements.
Each with five different queues provided:
  * ArrayBlockingQueue: backed by an array of a bounded queue.
  * LinkedBlockingQueue: a link from the node supports an optional bounded queue.
  * PriorityBlockingQueue: a support unbounded priority queue by the priority heap.
  * DelayQueue: a stack supported by a priority, time-based scheduling queue.
  * SynchronousQueue: a simple mechanism to gather BlockingQueue interface (rendezvous).

Guess you like

Origin www.cnblogs.com/guanxinjing/p/11654312.html