/** * Sets the cursor to a specific sequence and returns the preallocated entry that is stored there. This * can cause a data race and should only be done in controlled circumstances, e.g. during initialisation. * * @param sequence The sequence to claim. * @return The preallocated event. */ public E claimAndGetPreallocated(long sequence) { sequencer.claim(sequence); return get(sequence); }
/** * Resets the cursor to a specific value. This can be applied at any time, but it is worth noting * that it can cause a data race and should only be used in controlled circumstances. E.g. during * initialisation. * * @param sequence The sequence to reset too. * @throws IllegalStateException If any gating sequences have already been specified. */ @Deprecated public void resetTo(long sequence) { sequencer.claim(sequence); sequencer.publish(sequence); }
/** * Resets the cursor to a specific value. This can be applied at any time, but it is worth not that it is a racy thing to do and should only be used in * controlled circumstances. E.g. during initialisation. * * @param sequence The sequence to reset too. * @throws IllegalStateException If any gating sequences have already been specified. */ public void resetTo(long sequence) { sequencer.claim(sequence); sequencer.publish(sequence); }
/** * Sets the cursor to a specific sequence and returns the preallocated entry that is stored there. This is another deliberately racy call, that should only * be done in controlled circumstances, e.g. initialisation. * * @param sequence The sequence to claim. * @return The preallocated event. */ public E claimAndGetPreallocated(long sequence) { sequencer.claim(sequence); return get(sequence); }
@Test public void shouldClaimSpecificSequence() throws Exception { long sequence = 14L; sequencer.claim(sequence); sequencer.publish(sequence); assertThat(sequencer.next(), is(sequence + 1)); }
/** * Sets the cursor to a specific sequence and returns the preallocated entry that is stored there. This * can cause a data race and should only be done in controlled circumstances, e.g. during initialisation. * * @param sequence The sequence to claim. * @return The preallocated event. */ public E claimAndGetPreallocated(long sequence) { sequencer.claim(sequence); return get(sequence); }
/** * Resets the cursor to a specific value. This can be applied at any time, but it is worth noting * that it can cause a data race and should only be used in controlled circumstances. E.g. during * initialisation. * * @param sequence The sequence to reset too. * @throws IllegalStateException If any gating sequences have already been specified. */ @Deprecated public void resetTo(long sequence) { sequencer.claim(sequence); sequencer.publish(sequence); }
/** * Sets the cursor to a specific sequence and returns the preallocated entry that is stored there. This * can cause a data race and should only be done in controlled circumstances, e.g. during initialisation. * * @param sequence The sequence to claim. * @return The preallocated event. */ public E claimAndGetPreallocated(long sequence) { sequencer.claim(sequence); return get(sequence); }
/** * Sets the cursor to a specific sequence and returns the preallocated entry that is stored there. This * can cause a data race and should only be done in controlled circumstances, e.g. during initialisation. * * @param sequence The sequence to claim. * @return The preallocated event. */ public E claimAndGetPreallocated(long sequence) { sequencer.claim(sequence); return get(sequence); }
/** * Sets the cursor to a specific sequence and returns the preallocated entry that is stored there. This * can cause a data race and should only be done in controlled circumstances, e.g. during initialisation. * * @param sequence The sequence to claim. * @return The preallocated event. */ public E claimAndGetPreallocated(long sequence) { sequencer.claim(sequence); return get(sequence); }
/** * Resets the cursor to a specific value. This can be applied at any time, but it is worth noting * that it can cause a data race and should only be used in controlled circumstances. E.g. during * initialisation. * * @param sequence The sequence to reset too. * @throws IllegalStateException If any gating sequences have already been specified. */ @Deprecated public void resetTo(long sequence) { sequencer.claim(sequence); sequencer.publish(sequence); }
/** * Resets the cursor to a specific value. This can be applied at any time, but it is worth noting * that it can cause a data race and should only be used in controlled circumstances. E.g. during * initialisation. * * @param sequence The sequence to reset too. * @throws IllegalStateException If any gating sequences have already been specified. */ public void resetTo(long sequence) { sequencer.claim(sequence); sequencer.publish(sequence); }
/** * Resets the cursor to a specific value. This can be applied at any time, but it is worth noting * that it can cause a data race and should only be used in controlled circumstances. E.g. during * initialisation. * * @param sequence The sequence to reset too. * @throws IllegalStateException If any gating sequences have already been specified. */ @Deprecated public void resetTo(long sequence) { sequencer.claim(sequence); sequencer.publish(sequence); }