private void rotateCycle(
        AtomicLongArray producerCycleClaims,
        int activeCycle,
        long producerCycleClaim,
        int cycleIdBitShift,
        long maxCycleId)
    {
        final long cycleId = cycleId(producerCycleClaim, cycleIdBitShift);
        if (cycleId >= maxCycleId)
        {
            throw new IllegalStateException("exhausted cycle id space!");
        }
        final long nextCycleId = cycleId + 1;
        //it points at the beginning of the next cycle
        final long nextProducerCycleClaim = nextCycleId << cycleIdBitShift;
        final int nextActiveCycle = (activeCycle + 1) & 1;
        //it needs to be atomic: a producer fallen behind could claim it concurrently
        AtomicLongArrayAccess.soValue(producerCycleClaims, nextActiveCycle, nextProducerCycleClaim);
        //from now on a slow producer could move the claim and lead to another rotation: a cas is needed to detect it
        if (!casActiveCycleId(cycleId, nextCycleId))
        {
            throw new IllegalStateException("slow rotation due to producer thread starvation!");
        }
    }
NOTE: This class was automatically generated by org.jctools.queues.atomic.JavaParsingAtomicArrayQueueGenerator
which can found in the jctools-build module. The original source file is MpscArrayQueue.java.
jctools-experimental/src/main/java/org/jctools/queues/atomic/MpscRelaxedAtomicArrayQueue.java