My thread runs forever and calls ConcurrentLinkedQueue#poll() after a ConcurrentLinkedQueue#peek().
But under some conditions, the thread seems to hang. I know this is a bit vague but can people confirm for me that the methods poll() or peek() will NEVER block. Thanks.
For what I can tell, the ConcurrentLinkedQueue is a ‘wait-free’ implementation.
So I must assume that each independent call to
poll()orpeek()will NEVER block.Atomic operations on this collection are synchronized and each individual call to the queue is guaranteed thread-safe.
There must be a problem with your code. For instance, if you do:
Does not garentee that
objwill not benull.