@Override public T poll() { long ci = consumerIndex; int offset = (int) ci & mask; T value = get(offset); if (value == null) { return null; } CONSUMER_INDEX.lazySet(this, ci + 1); lazySet(offset, null); return value; }
@Override public boolean offer(T value) { if (value == null) { throw new NullPointerException(); } long pi = producerIndex; int m = mask; int fullCheck = (int) (pi + capacitySkip) & m; if (get(fullCheck) != null) { return false; } int offset = (int) pi & m; PRODUCER_INDEX.lazySet(this, pi + 1); lazySet(offset, value); return true; }
private void soConsumerIndex(long v) { CONSUMER_INDEX.lazySet(this, v); }
private void soProducerIndex(long v) { PRODUCER_INDEX.lazySet(this, v); }