@Override
    public int size()
    {
        final int cycleIdBitShift = this.cycleIdBitShift;

        long after = lvConsumerPosition();
        long producerClaimCycleId;
        long before;
        long activeCycleId;

        int positionWithinCycle;
        long producerClaim;

        do
        {
            before = after;
            activeCycleId = lvActiveCycleId();
            producerClaim = lvProducerCycleClaim(activeCycleIndex(activeCycleId));
            after = lvConsumerPosition();
            producerClaimCycleId = producerClaimCycleId(producerClaim, cycleIdBitShift);
            positionWithinCycle = positionWithinCycle(producerClaim, this.positionWithinCycleMask);
        }
        while (positionWithinCycle > this.cycleLength || before != after || activeCycleId != producerClaimCycleId);

        // need to have a stable consumer and a valid claim
        final long size = producerPosition(positionWithinCycle, producerClaimCycleId, this.cycleLengthLog2) - after;
        if (size > mask + 1)
        {
            return (int) (mask + 1);
        }
        else
        {
            return (int) size;
        }
    }
Validates a slow producer over-claim throwing {@link IllegalStateException} if the offer on it can't continue.
jctools-experimental/src/main/java/org/jctools/queues/MpscRelaxedArrayQueue.java