@Override
    public int fill(final Supplier<E> s, final int limit) {
        if (null == s)
            throw new IllegalArgumentException("supplier is null");
        if (limit < 0)
            throw new IllegalArgumentException("limit is negative:" + limit);
        if (limit == 0)
            return 0;
        final E[] buffer = this.buffer;
        final long mask = this.mask;
        long producerIndex = this.lpProducerIndex();
        for (int i = 0; i < limit; i++) {
            final long offset = calcCircularRefElementOffset(producerIndex, mask);
            if (null != lvRefElement(buffer, offset)) {
                return i;
            }
            producerIndex++;
            soRefElement(buffer, offset, s.get());
            // ordered store -> atomic and ordered for size()
            soProducerIndex(producerIndex);
        }
        return limit;
    }
NOTE: This class was automatically generated by org.jctools.queues.unpadded.JavaParsingUnpaddedQueueGenerator
which can found in the jctools-build module. The original source file is SpmcArrayQueue.java.
jctools-core/src/main/java/org/jctools/queues/unpadded/SpmcUnpaddedArrayQueue.java