Class MaxMulticastFlowControl

java.lang.Object
io.aeron.driver.MaxMulticastFlowControl
All Implemented Interfaces:
FlowControl, AutoCloseable

public class MaxMulticastFlowControl extends Object implements FlowControl
Default multicast sender flow control strategy.

Max of right edges. No tracking of receivers.

  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final String
    URI param value to identify this FlowControl strategy.
    Singleton instance which can be used to avoid allocation.
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    boolean
    Has the flow control strategy its required group of receivers to be considered connected? The result of this feeds into the determination of if a publication is connected.
    void
    initialize(MediaDriver.Context context, CountersManager countersManager, UdpChannel udpChannel, int streamId, int sessionId, long registrationId, int initialTermId, int termBufferLength)
    Initialize the flow control strategy for a stream.
    int
    maxRetransmissionLength(int termOffset, int resendLength, int termBufferLength, int mtuLength)
    The maximum window length allowed to retransmit per NAK.
    void
    onError(ErrorFlyweight errorFlyweight, InetSocketAddress receiverAddress, long timeNs)
    Update the sender flow control strategy if an error comes from one of the receivers.
    long
    onIdle(long timeNs, long senderLimit, long senderPosition, boolean isEos)
    Perform any maintenance needed by the flow control strategy and return current sender limit position.
    long
    onSetup(SetupFlyweight flyweight, long senderLimit, long senderPosition, int positionBitsToShift, long timeNs)
    Update the sender flow control strategy based on an elicited setup message being sent out.
    long
    onStatusMessage(StatusMessageFlyweight flyweight, InetSocketAddress receiverAddress, long senderLimit, int initialTermId, int positionBitsToShift, long timeNs)
    Update the sender flow control strategy based on a status message from the receiver.
    void
    onTriggerSendSetup(StatusMessageFlyweight flyweight, InetSocketAddress receiverAddress, long timeNs)
    Update the sender flow control strategy based on a Status Message received triggering a setup to be sent.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

  • Constructor Details

    • MaxMulticastFlowControl

      public MaxMulticastFlowControl()
  • Method Details

    • initialize

      public void initialize(MediaDriver.Context context, CountersManager countersManager, UdpChannel udpChannel, int streamId, int sessionId, long registrationId, int initialTermId, int termBufferLength)
      Initialize the flow control strategy for a stream.
      Specified by:
      initialize in interface FlowControl
      Parameters:
      context - to allow access to media driver configuration
      countersManager - to use for any counters in use by the strategy
      udpChannel - for the stream.
      streamId - for the stream.
      sessionId - for the stream.
      registrationId - for the stream.
      initialTermId - at which the stream started.
      termBufferLength - to use as the length of each term buffer.
    • close

      public void close()
      Specified by:
      close in interface AutoCloseable
      Specified by:
      close in interface FlowControl
    • onStatusMessage

      public long onStatusMessage(StatusMessageFlyweight flyweight, InetSocketAddress receiverAddress, long senderLimit, int initialTermId, int positionBitsToShift, long timeNs)
      Update the sender flow control strategy based on a status message from the receiver.
      Specified by:
      onStatusMessage in interface FlowControl
      Parameters:
      flyweight - over the status message received.
      receiverAddress - of the receiver.
      senderLimit - the current sender position limit.
      initialTermId - for the term buffers.
      positionBitsToShift - in use for the length of each term buffer.
      timeNs - current time (in nanoseconds).
      Returns:
      the new position limit to be employed by the sender.
    • onTriggerSendSetup

      public void onTriggerSendSetup(StatusMessageFlyweight flyweight, InetSocketAddress receiverAddress, long timeNs)
      Update the sender flow control strategy based on a Status Message received triggering a setup to be sent.
      Specified by:
      onTriggerSendSetup in interface FlowControl
      Parameters:
      flyweight - over the Status Message received
      receiverAddress - of the receiver.
      timeNs - current time (in nanoseconds).
    • onSetup

      public long onSetup(SetupFlyweight flyweight, long senderLimit, long senderPosition, int positionBitsToShift, long timeNs)
      Update the sender flow control strategy based on an elicited setup message being sent out.
      Specified by:
      onSetup in interface FlowControl
      Parameters:
      flyweight - over the setup to be sent.
      senderLimit - for the current sender position.
      senderPosition - which has been sent.
      positionBitsToShift - in use for the length of each term buffer.
      timeNs - current time in nanoseconds.
      Returns:
      the new position limit to be employed by the sender.
    • onIdle

      public long onIdle(long timeNs, long senderLimit, long senderPosition, boolean isEos)
      Perform any maintenance needed by the flow control strategy and return current sender limit position.
      Specified by:
      onIdle in interface FlowControl
      Parameters:
      timeNs - current time in nanoseconds.
      senderLimit - for the current sender position.
      senderPosition - which has been sent.
      isEos - is this end-of-stream for the sender.
      Returns:
      the position limit to be employed by the sender.
    • onError

      public void onError(ErrorFlyweight errorFlyweight, InetSocketAddress receiverAddress, long timeNs)
      Update the sender flow control strategy if an error comes from one of the receivers.
      Specified by:
      onError in interface FlowControl
      Parameters:
      errorFlyweight - over the error received.
      receiverAddress - the address of the receiver.
      timeNs - current time in nanoseconds
    • hasRequiredReceivers

      public boolean hasRequiredReceivers()
      Has the flow control strategy its required group of receivers to be considered connected? The result of this feeds into the determination of if a publication is connected.
      Specified by:
      hasRequiredReceivers in interface FlowControl
      Returns:
      true if the required group of receivers is connected, otherwise false.
    • maxRetransmissionLength

      public int maxRetransmissionLength(int termOffset, int resendLength, int termBufferLength, int mtuLength)
      The maximum window length allowed to retransmit per NAK. Will limit it by an estimate of the window limit and to the end of the current term.
      Specified by:
      maxRetransmissionLength in interface FlowControl
      Parameters:
      termOffset - of the NAK.
      resendLength - of the NAK.
      termBufferLength - of the publication.
      mtuLength - of the publication.
      Returns:
      the maximum window length allowed to retransmit per NAK.