/** * Get the current cursor value for the ring buffer. The actual value received * will depend on the type of {@link Sequencer} that is being used. * * @see MultiProducerSequencer * @see SingleProducerSequencer */ @Override public long getCursor() { return sequencer.getCursor(); }
/** * Get the current cursor value for the ring buffer. The cursor value is the last value that was published, or the highest available sequence that can be * consumed. */ public long getCursor() { return sequencer.getCursor(); }
@Test public void shouldHoldUpPublisherWhenBufferIsFull() throws InterruptedException { sequencer.addGatingSequences(gatingSequence); long sequence = sequencer.next(BUFFER_SIZE); sequencer.publish(sequence - (BUFFER_SIZE - 1), sequence); final CountDownLatch waitingLatch = new CountDownLatch(1); final CountDownLatch doneLatch = new CountDownLatch(1); final long expectedFullSequence = Sequencer.INITIAL_CURSOR_VALUE + sequencer.getBufferSize(); assertThat(sequencer.getCursor(), is(expectedFullSequence)); executor.submit( new Runnable() { @Override public void run() { waitingLatch.countDown(); long next = sequencer.next(); sequencer.publish(next); doneLatch.countDown(); } }); waitingLatch.await(); assertThat(sequencer.getCursor(), is(expectedFullSequence)); gatingSequence.set(Sequencer.INITIAL_CURSOR_VALUE + 1L); doneLatch.await(); assertThat(sequencer.getCursor(), is(expectedFullSequence + 1L)); }
else if (sequencer.getCursor() >= nextSequence)
/** * Get the current cursor value for the ring buffer. The actual value received * will depend on the type of {@link Sequencer} that is being used. * * @see MultiProducerSequencer * @see SingleProducerSequencer */ @Override public long getCursor() { return sequencer.getCursor(); }
/** * Get the current cursor value for the ring buffer. The actual value recieved * will depend on the type of {@link Sequencer} that is being used. * * @see MultiProducerSequencer * @see SingleProducerSequencer */ @Override public long getCursor() { return sequencer.getCursor(); }
else if (sequencer.getCursor() >= nextSequence)
/** * Get the current cursor value for the ring buffer. The actual value received * will depend on the type of {@link Sequencer} that is being used. * * @see MultiProducerSequencer * @see SingleProducerSequencer */ @Override public long getCursor() { return sequencer.getCursor(); }
/** * Get the current cursor value for the ring buffer. The actual value recieved * will depend on the type of {@link Sequencer} that is being used. * * @see MultiProducerSequencer * @see SingleProducerSequencer */ @Override public long getCursor() { return sequencer.getCursor(); }
else if (sequencer.getCursor() >= nextSequence)
else if (sequencer.getCursor() >= nextSequence)
else if (sequencer.getCursor() >= nextSequence)