http://www.java2s.com/Open-Source/Java-Open-Source-Library/7-JDK/java/java/util/concurrent/ConcurrentLinkedQueue.java.htm
The above is the source code of ConcurrentL
The ConcurrentLinkedQueue
allows concurrent modification of the internal list while traversing it. This implies that the node you are looking at could have been removed concurrently. To detect such situations the next pointer of a removed node is changed to point to itself. Look at updateHead
(L302) for details.
The condition asks the question "Is the current node the same as the next node?"
If so, you've fallen off list ( documentation in line. )
The basic outline of steps is:
The other parts of the if statement are handling concurrent modification issues.
To better understand what's going on, read Node.casTail() and the casNext()