@Override
	long next(int n) {
		long nextValue = this.nextValue;

		long nextSequence = nextValue + n;
		long wrapPoint = nextSequence - bufferSize;
		long cachedGatingSequence = this.cachedValue;

		if (wrapPoint > cachedGatingSequence || cachedGatingSequence > nextValue)
		{
			long minSequence;
			while (wrapPoint > (minSequence = RingBuffer.getMinimumSequence(gatingSequences, nextValue)))
			{
				if(spinObserver != null) {
					spinObserver.run();
				}
				LockSupport.parkNanos(1L); // TODO: Use waitStrategy to spin?
			}

			this.cachedValue = minSequence;
		}

		this.nextValue = nextSequence;

		return nextSequence;
	}
@Override
	long next(int n) {
		long nextValue = this.nextValue;

		long nextSequence = nextValue + n;
		long wrapPoint = nextSequence - bufferSize;
		long cachedGatingSequence = this.cachedValue;

		if (wrapPoint > cachedGatingSequence || cachedGatingSequence > nextValue)
		{
			long minSequence;
			while (wrapPoint > (minSequence = RingBuffer.getMinimumSequence(gatingSequences, nextValue)))
			{
				if(spinObserver != null) {
					spinObserver.run();
				}
				LockSupport.parkNanos(1L); 
			}

			this.cachedValue = minSequence;
		}

		this.nextValue = nextSequence;

		return nextSequence;
	}
@ Override long next ( int n ) { long nextValue = this . nextValue ; long nextSequence = nextValue + n ; long wrapPoint = nextSequence - bufferSize ; long cachedGatingSequence = this . cachedValue ; if ( wrapPoint > cachedGatingSequence || cachedGatingSequence > nextValue ) { long minSequence ; while ( wrapPoint > ( minSequence = RingBuffer . getMinimumSequence ( gatingSequences , nextValue ) ) ) { if ( spinObserver != null ) { spinObserver . run ( ) ; } LockSupport . parkNanos ( 1L ) ; // TODO: Use waitStrategy to spin? } this . cachedValue = minSequence ; } this . nextValue = nextSequence ; return nextSequence ; }
See {@code RingBufferProducer.next(int)}.
See {