Interface Sequencer

    • Field Detail

      • INITIAL_CURSOR_VALUE

        static final long INITIAL_CURSOR_VALUE
        Set to -1 as sequence starting point
        See Also:
        Constant Field Values
    • Method Detail

      • claim

        void claim​(long sequence)
        Claim a specific sequence. Only used if initialising the ring buffer to a specific value.
        Parameters:
        sequence - The sequence to initialise too.
      • isAvailable

        boolean isAvailable​(long sequence)
        Confirms if a sequence is published and the event is available for use; non-blocking.
        Parameters:
        sequence - of the buffer to check
        Returns:
        true if the sequence is available for use, false if not
      • addGatingSequences

        void addGatingSequences​(Sequence... gatingSequences)
        Add the specified gating sequences to this instance of the Disruptor. They will safely and atomically added to the list of gating sequences.
        Parameters:
        gatingSequences - The sequences to add.
      • removeGatingSequence

        boolean removeGatingSequence​(Sequence sequence)
        Remove the specified sequence from this sequencer.
        Parameters:
        sequence - to be removed.
        Returns:
        true if this sequence was found, false otherwise.
      • newBarrier

        SequenceBarrier newBarrier​(Sequence... sequencesToTrack)
        Create a new SequenceBarrier to be used by an EventProcessor to track which messages are available to be read from the ring buffer given a list of sequences to track.
        Parameters:
        sequencesToTrack - All of the sequences that the newly constructed barrier will wait on.
        Returns:
        A sequence barrier that will track the specified sequences.
        See Also:
        SequenceBarrier
      • getMinimumSequence

        long getMinimumSequence()
        Get the minimum sequence value from all of the gating sequences added to this ringBuffer.
        Returns:
        The minimum gating sequence or the cursor sequence if no sequences have been added.
      • getHighestPublishedSequence

        long getHighestPublishedSequence​(long nextSequence,
                                         long availableSequence)
        Get the highest sequence number that can be safely read from the ring buffer. Depending on the implementation of the Sequencer this call may need to scan a number of values in the Sequencer. The scan will range from nextSequence to availableSequence. If there are no available values >= nextSequence the return value will be nextSequence - 1. To work correctly a consumer should pass a value that is 1 higher than the last sequence that was successfully processed.
        Parameters:
        nextSequence - The sequence to start scanning from.
        availableSequence - The sequence to scan to.
        Returns:
        The highest value that can be safely read, will be at least nextSequence - 1.
      • newPoller

        <T> EventPoller<T> newPoller​(DataProvider<T> provider,
                                     Sequence... gatingSequences)
        Creates an event poller from this sequencer
        Type Parameters:
        T - the type of the event
        Parameters:
        provider - from which events are drawn
        gatingSequences - sequences to be gated on
        Returns:
        the event poller