private QNode getValidatedTail ( ) { for ( ; ; ) { QNode h = this . head . get ( ) ; QNode first = h . next ; if ( first != null && first . next == first ) { // help advance advanceHead ( h , first ) ; continue ; } QNode t = this . tail . get ( ) ; QNode last = t . next ; if ( t == this . tail . get ( ) ) { if ( last != null ) { this . tail . compareAndSet ( t , last ) ; // help advance } else { return t ; } } } }
Returns validated tail for use in cleaning methods