Interface EventSink<E>

  • Type Parameters:
    E - The event type
    All Known Implementing Classes:
    RingBuffer

    public interface EventSink<E>
    Write interface for RingBuffer.
    • Method Detail

      • publishEvent

        void publishEvent​(EventTranslator<E> translator)
        Publishes an event to the ring buffer. It handles claiming the next sequence, getting the current (uninitialised) event from the ring buffer and publishing the claimed sequence after translation.
        Parameters:
        translator - The user specified translation for the event
      • tryPublishEvent

        boolean tryPublishEvent​(EventTranslator<E> translator)
        Attempts to publish an event to the ring buffer. It handles claiming the next sequence, getting the current (uninitialised) event from the ring buffer and publishing the claimed sequence after translation. Will return false if specified capacity was not available.
        Parameters:
        translator - The user specified translation for the event
        Returns:
        true if the value was published, false if there was insufficient capacity.
      • publishEvent

        <A> void publishEvent​(EventTranslatorOneArg<E,​A> translator,
                              A arg0)
        Allows one user supplied argument.
        Type Parameters:
        A - Class of the user supplied argument
        Parameters:
        translator - The user specified translation for the event
        arg0 - A user supplied argument.
        See Also:
        publishEvent(EventTranslator)
      • tryPublishEvent

        <A> boolean tryPublishEvent​(EventTranslatorOneArg<E,​A> translator,
                                    A arg0)
        Allows one user supplied argument.
        Type Parameters:
        A - Class of the user supplied argument
        Parameters:
        translator - The user specified translation for the event
        arg0 - A user supplied argument.
        Returns:
        true if the value was published, false if there was insufficient capacity.
        See Also:
        tryPublishEvent(EventTranslator)
      • publishEvent

        <A,​B> void publishEvent​(EventTranslatorTwoArg<E,​A,​B> translator,
                                      A arg0,
                                      B arg1)
        Allows two user supplied arguments.
        Type Parameters:
        A - Class of the user supplied argument
        B - Class of the user supplied argument
        Parameters:
        translator - The user specified translation for the event
        arg0 - A user supplied argument.
        arg1 - A user supplied argument.
        See Also:
        publishEvent(EventTranslator)
      • tryPublishEvent

        <A,​B> boolean tryPublishEvent​(EventTranslatorTwoArg<E,​A,​B> translator,
                                            A arg0,
                                            B arg1)
        Allows two user supplied arguments.
        Type Parameters:
        A - Class of the user supplied argument
        B - Class of the user supplied argument
        Parameters:
        translator - The user specified translation for the event
        arg0 - A user supplied argument.
        arg1 - A user supplied argument.
        Returns:
        true if the value was published, false if there was insufficient capacity.
        See Also:
        tryPublishEvent(EventTranslator)
      • publishEvent

        <A,​B,​C> void publishEvent​(EventTranslatorThreeArg<E,​A,​B,​C> translator,
                                              A arg0,
                                              B arg1,
                                              C arg2)
        Allows three user supplied arguments
        Type Parameters:
        A - Class of the user supplied argument
        B - Class of the user supplied argument
        C - Class of the user supplied argument
        Parameters:
        translator - The user specified translation for the event
        arg0 - A user supplied argument.
        arg1 - A user supplied argument.
        arg2 - A user supplied argument.
        See Also:
        publishEvent(EventTranslator)
      • tryPublishEvent

        <A,​B,​C> boolean tryPublishEvent​(EventTranslatorThreeArg<E,​A,​B,​C> translator,
                                                    A arg0,
                                                    B arg1,
                                                    C arg2)
        Allows three user supplied arguments
        Type Parameters:
        A - Class of the user supplied argument
        B - Class of the user supplied argument
        C - Class of the user supplied argument
        Parameters:
        translator - The user specified translation for the event
        arg0 - A user supplied argument.
        arg1 - A user supplied argument.
        arg2 - A user supplied argument.
        Returns:
        true if the value was published, false if there was insufficient capacity.
        See Also:
        publishEvent(EventTranslator)
      • publishEvent

        void publishEvent​(EventTranslatorVararg<E> translator,
                          java.lang.Object... args)
        Allows a variable number of user supplied arguments
        Parameters:
        translator - The user specified translation for the event
        args - User supplied arguments.
        See Also:
        publishEvent(EventTranslator)
      • tryPublishEvent

        boolean tryPublishEvent​(EventTranslatorVararg<E> translator,
                                java.lang.Object... args)
        Allows a variable number of user supplied arguments
        Parameters:
        translator - The user specified translation for the event
        args - User supplied arguments.
        Returns:
        true if the value was published, false if there was insufficient capacity.
        See Also:
        publishEvent(EventTranslator)
      • publishEvents

        void publishEvents​(EventTranslator<E>[] translators)

        Publishes multiple events to the ring buffer. It handles claiming the next sequence, getting the current (uninitialised) event from the ring buffer and publishing the claimed sequence after translation.

        With this call the data that is to be inserted into the ring buffer will be a field (either explicitly or captured anonymously), therefore this call will require an instance of the translator for each value that is to be inserted into the ring buffer.

        Parameters:
        translators - The user specified translation for each event
      • publishEvents

        void publishEvents​(EventTranslator<E>[] translators,
                           int batchStartsAt,
                           int batchSize)

        Publishes multiple events to the ring buffer. It handles claiming the next sequence, getting the current (uninitialised) event from the ring buffer and publishing the claimed sequence after translation.

        With this call the data that is to be inserted into the ring buffer will be a field (either explicitly or captured anonymously), therefore this call will require an instance of the translator for each value that is to be inserted into the ring buffer.

        Parameters:
        translators - The user specified translation for each event
        batchStartsAt - The first element of the array which is within the batch.
        batchSize - The actual size of the batch
      • tryPublishEvents

        boolean tryPublishEvents​(EventTranslator<E>[] translators)
        Attempts to publish multiple events to the ring buffer. It handles claiming the next sequence, getting the current (uninitialised) event from the ring buffer and publishing the claimed sequence after translation. Will return false if specified capacity was not available.
        Parameters:
        translators - The user specified translation for the event
        Returns:
        true if the value was published, false if there was insufficient capacity.
      • tryPublishEvents

        boolean tryPublishEvents​(EventTranslator<E>[] translators,
                                 int batchStartsAt,
                                 int batchSize)
        Attempts to publish multiple events to the ring buffer. It handles claiming the next sequence, getting the current (uninitialised) event from the ring buffer and publishing the claimed sequence after translation. Will return false if specified capacity was not available.
        Parameters:
        translators - The user specified translation for the event
        batchStartsAt - The first element of the array which is within the batch.
        batchSize - The actual size of the batch
        Returns:
        true if all the values were published, false if there was insufficient capacity.
      • publishEvents

        <A> void publishEvents​(EventTranslatorOneArg<E,​A> translator,
                               int batchStartsAt,
                               int batchSize,
                               A[] arg0)
        Allows one user supplied argument per event.
        Type Parameters:
        A - Class of the user supplied argument
        Parameters:
        translator - The user specified translation for each event
        batchStartsAt - The first element of the array which is within the batch.
        batchSize - The actual size of the batch
        arg0 - An array of user supplied arguments, one element per event.
        See Also:
        publishEvents(EventTranslator[])
      • tryPublishEvents

        <A> boolean tryPublishEvents​(EventTranslatorOneArg<E,​A> translator,
                                     A[] arg0)
        Allows one user supplied argument.
        Type Parameters:
        A - Class of the user supplied argument
        Parameters:
        translator - The user specified translation for each event
        arg0 - An array of user supplied arguments, one element per event.
        Returns:
        true if the value was published, false if there was insufficient capacity.
        See Also:
        tryPublishEvents(com.lmax.disruptor.EventTranslator[])
      • tryPublishEvents

        <A> boolean tryPublishEvents​(EventTranslatorOneArg<E,​A> translator,
                                     int batchStartsAt,
                                     int batchSize,
                                     A[] arg0)
        Allows one user supplied argument.
        Type Parameters:
        A - Class of the user supplied argument
        Parameters:
        translator - The user specified translation for each event
        batchStartsAt - The first element of the array which is within the batch.
        batchSize - The actual size of the batch
        arg0 - An array of user supplied arguments, one element per event.
        Returns:
        true if the value was published, false if there was insufficient capacity.
        See Also:
        tryPublishEvents(EventTranslator[])
      • publishEvents

        <A,​B> void publishEvents​(EventTranslatorTwoArg<E,​A,​B> translator,
                                       A[] arg0,
                                       B[] arg1)
        Allows two user supplied arguments per event.
        Type Parameters:
        A - Class of the user supplied argument
        B - Class of the user supplied argument
        Parameters:
        translator - The user specified translation for the event
        arg0 - An array of user supplied arguments, one element per event.
        arg1 - An array of user supplied arguments, one element per event.
        See Also:
        publishEvents(com.lmax.disruptor.EventTranslator[])
      • publishEvents

        <A,​B> void publishEvents​(EventTranslatorTwoArg<E,​A,​B> translator,
                                       int batchStartsAt,
                                       int batchSize,
                                       A[] arg0,
                                       B[] arg1)
        Allows two user supplied arguments per event.
        Type Parameters:
        A - Class of the user supplied argument
        B - Class of the user supplied argument
        Parameters:
        translator - The user specified translation for the event
        batchStartsAt - The first element of the array which is within the batch.
        batchSize - The actual size of the batch.
        arg0 - An array of user supplied arguments, one element per event.
        arg1 - An array of user supplied arguments, one element per event.
        See Also:
        publishEvents(EventTranslator[])
      • tryPublishEvents

        <A,​B> boolean tryPublishEvents​(EventTranslatorTwoArg<E,​A,​B> translator,
                                             A[] arg0,
                                             B[] arg1)
        Allows two user supplied arguments per event.
        Type Parameters:
        A - Class of the user supplied argument
        B - Class of the user supplied argument
        Parameters:
        translator - The user specified translation for the event
        arg0 - An array of user supplied arguments, one element per event.
        arg1 - An array of user supplied arguments, one element per event.
        Returns:
        true if the value was published, false if there was insufficient capacity.
        See Also:
        tryPublishEvents(com.lmax.disruptor.EventTranslator[])
      • tryPublishEvents

        <A,​B> boolean tryPublishEvents​(EventTranslatorTwoArg<E,​A,​B> translator,
                                             int batchStartsAt,
                                             int batchSize,
                                             A[] arg0,
                                             B[] arg1)
        Allows two user supplied arguments per event.
        Type Parameters:
        A - Class of the user supplied argument
        B - Class of the user supplied argument
        Parameters:
        translator - The user specified translation for the event
        batchStartsAt - The first element of the array which is within the batch.
        batchSize - The actual size of the batch.
        arg0 - An array of user supplied arguments, one element per event.
        arg1 - An array of user supplied arguments, one element per event.
        Returns:
        true if the value was published, false if there was insufficient capacity.
        See Also:
        tryPublishEvents(EventTranslator[])
      • publishEvents

        <A,​B,​C> void publishEvents​(EventTranslatorThreeArg<E,​A,​B,​C> translator,
                                               A[] arg0,
                                               B[] arg1,
                                               C[] arg2)
        Allows three user supplied arguments per event.
        Type Parameters:
        A - Class of the user supplied argument
        B - Class of the user supplied argument
        C - Class of the user supplied argument
        Parameters:
        translator - The user specified translation for the event
        arg0 - An array of user supplied arguments, one element per event.
        arg1 - An array of user supplied arguments, one element per event.
        arg2 - An array of user supplied arguments, one element per event.
        See Also:
        publishEvents(com.lmax.disruptor.EventTranslator[])
      • publishEvents

        <A,​B,​C> void publishEvents​(EventTranslatorThreeArg<E,​A,​B,​C> translator,
                                               int batchStartsAt,
                                               int batchSize,
                                               A[] arg0,
                                               B[] arg1,
                                               C[] arg2)
        Allows three user supplied arguments per event.
        Type Parameters:
        A - Class of the user supplied argument
        B - Class of the user supplied argument
        C - Class of the user supplied argument
        Parameters:
        translator - The user specified translation for the event
        batchStartsAt - The first element of the array which is within the batch.
        batchSize - The number of elements in the batch.
        arg0 - An array of user supplied arguments, one element per event.
        arg1 - An array of user supplied arguments, one element per event.
        arg2 - An array of user supplied arguments, one element per event.
        See Also:
        publishEvents(EventTranslator[])
      • tryPublishEvents

        <A,​B,​C> boolean tryPublishEvents​(EventTranslatorThreeArg<E,​A,​B,​C> translator,
                                                     A[] arg0,
                                                     B[] arg1,
                                                     C[] arg2)
        Allows three user supplied arguments per event.
        Type Parameters:
        A - Class of the user supplied argument
        B - Class of the user supplied argument
        C - Class of the user supplied argument
        Parameters:
        translator - The user specified translation for the event
        arg0 - An array of user supplied arguments, one element per event.
        arg1 - An array of user supplied arguments, one element per event.
        arg2 - An array of user supplied arguments, one element per event.
        Returns:
        true if the value was published, false if there was insufficient capacity.
        See Also:
        publishEvents(com.lmax.disruptor.EventTranslator[])
      • tryPublishEvents

        <A,​B,​C> boolean tryPublishEvents​(EventTranslatorThreeArg<E,​A,​B,​C> translator,
                                                     int batchStartsAt,
                                                     int batchSize,
                                                     A[] arg0,
                                                     B[] arg1,
                                                     C[] arg2)
        Allows three user supplied arguments per event.
        Type Parameters:
        A - Class of the user supplied argument
        B - Class of the user supplied argument
        C - Class of the user supplied argument
        Parameters:
        translator - The user specified translation for the event
        batchStartsAt - The first element of the array which is within the batch.
        batchSize - The actual size of the batch.
        arg0 - An array of user supplied arguments, one element per event.
        arg1 - An array of user supplied arguments, one element per event.
        arg2 - An array of user supplied arguments, one element per event.
        Returns:
        true if the value was published, false if there was insufficient capacity.
        See Also:
        publishEvents(EventTranslator[])
      • publishEvents

        void publishEvents​(EventTranslatorVararg<E> translator,
                           int batchStartsAt,
                           int batchSize,
                           java.lang.Object[]... args)
        Allows a variable number of user supplied arguments per event.
        Parameters:
        translator - The user specified translation for the event
        batchStartsAt - The first element of the array which is within the batch.
        batchSize - The actual size of the batch
        args - User supplied arguments, one Object[] per event.
        See Also:
        publishEvents(EventTranslator[])
      • tryPublishEvents

        boolean tryPublishEvents​(EventTranslatorVararg<E> translator,
                                 java.lang.Object[]... args)
        Allows a variable number of user supplied arguments per event.
        Parameters:
        translator - The user specified translation for the event
        args - User supplied arguments, one Object[] per event.
        Returns:
        true if the value was published, false if there was insufficient capacity.
        See Also:
        publishEvents(com.lmax.disruptor.EventTranslator[])
      • tryPublishEvents

        boolean tryPublishEvents​(EventTranslatorVararg<E> translator,
                                 int batchStartsAt,
                                 int batchSize,
                                 java.lang.Object[]... args)
        Allows a variable number of user supplied arguments per event.
        Parameters:
        translator - The user specified translation for the event
        batchStartsAt - The first element of the array which is within the batch.
        batchSize - The actual size of the batch.
        args - User supplied arguments, one Object[] per event.
        Returns:
        true if the value was published, false if there was insufficient capacity.
        See Also:
        publishEvents(EventTranslator[])