@Override
    public E peek() {
        final AtomicReferenceArray<E> buffer = this.buffer;
        final int mask = this.mask;
        long currProducerIndexCache = lvProducerIndexCache();
        long currentConsumerIndex;
        long nextConsumerIndex = lvConsumerIndex();
        E e;
        do {
            currentConsumerIndex = nextConsumerIndex;
            if (currentConsumerIndex >= currProducerIndexCache) {
                long currProducerIndex = lvProducerIndex();
                if (currentConsumerIndex >= currProducerIndex) {
                    return null;
                } else {
                    currProducerIndexCache = currProducerIndex;
                    svProducerIndexCache(currProducerIndex);
                }
            }
            e = lvRefElement(buffer, calcCircularRefElementOffset(currentConsumerIndex, mask));
            // sandwich the element load between 2 consumer index loads
            nextConsumerIndex = lvConsumerIndex();
        } while (null == e || nextConsumerIndex != currentConsumerIndex);
        return e;
    }
NOTE: This class was automatically generated by org.jctools.queues.atomic.unpadded.JavaParsingAtomicUnpaddedArrayQueueGenerator
which can found in the jctools-build module. The original source file is SpmcArrayQueue.java.
jctools-core/src/main/java/org/jctools/queues/atomic/unpadded/SpmcAtomicUnpaddedArrayQueue.java