private int incrementAndGetModulo(int modulo) {
        for (;;) {
            int current = nextIndex.get();
            int next = (current + 1) % modulo;
            if (nextIndex.compareAndSet(current, next) && current < modulo)
                return current;
        }
    }
Referenced from RoundRobinRule
Inspired by the implementation of {@link AtomicInteger#incrementAndGet()}.

@param modulo The modulo to bound the value of the counter.
@return The next value.
ribbon-loadbalancer/src/main/java/com/netflix/loadbalancer/AbstractServerPredicate.java