What is the difference between LinkedBlockingQueue and ConcurrentLinkedQueue?

I read the blog, but I'm not sure if it is done correctly:

http://www.javacodegeeks.com/2010/09/java-best-practices-queue-battle-and.html#ixzz1seaiSLwp

He said: As can be seen from the above performance results, LinkedBlockingQueue has achieved better results (adding and removing elements) and should be your number one candidate for implementing producer-consumer scenarios.

Interesting, isn't it if I don't use locking in my code?

So, why is LinkedBlockingQueue faster than an unlocked queue (ConcurrentLinkedQueue)?

Thank!

+5
source share
3 answers

ConcurrentLinkedQueue . BlockingQueue put() take(). /, , , , , .

+4

: - . , .

while(result == null)
   result = concurrentLinkedQueue.poll();

, , , :

linkedBlockingQueue.take();
+1

LinkedBlockingQueue - Deque ConcurrentBlockingQueue. Javadoc

-1

All Articles