@Override
    public E peek() {
        // Copy field to avoid re-reading after volatile load
        final AtomicReferenceArray<E> buffer = this.buffer;

        final long consumerIndex = lvConsumerIndex(); // LoadLoad
        final int offset = calcElementOffset(consumerIndex);
        E e = lvElement(buffer, offset);
        if (null == e) {
            /*
             * NOTE: Queue may not actually be empty in the case of a producer (P1) being interrupted after
             * winning the CAS on offer but before storing the element in the queue. Other producers may go on
             * to fill up the queue after this element.
             */
            if (consumerIndex != lvProducerIndex()) {
                do {
                    e = lvElement(buffer, offset);
                } while (e == null);
            } else {
                return null;
            }
        }
        return e;
    }
@ Override public E peek ( ) { final AtomicReferenceArray < E > buffer = this . buffer ; final long consumerIndex = lvConsumerIndex ( ) ; final int offset = calcElementOffset ( consumerIndex ) ; E e = lvElement ( buffer , offset ) ; if ( null == e ) { if ( consumerIndex != lvProducerIndex ( ) ) { do { e = lvElement ( buffer , offset ) ; } while ( e == null ) ; } else { return null ; } } return e ; }
{@inheritDoc}
<p>
IMPLEMENTATION NOTES:<br>
Lock free peek using ordered loads. As class name suggests access is limited to a single thread.

@see java.util.Queue#poll()
@see org.jctools_voltpatches.queues.MessagePassingQueue#poll()