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!
ConcurrentLinkedQueue . BlockingQueue put() take(). /, , , , , .
: - . , .
while(result == null) result = concurrentLinkedQueue.poll();
, , , :
linkedBlockingQueue.take();
LinkedBlockingQueue - Deque ConcurrentBlockingQueue. Javadoc