Package io.aeron.driver
Class MaxMulticastFlowControl
java.lang.Object
io.aeron.driver.MaxMulticastFlowControl
- All Implemented Interfaces:
FlowControl
,AutoCloseable
Default multicast sender flow control strategy.
Max of right edges. No tracking of receivers.
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final String
URI param value to identify thisFlowControl
strategy.static final MaxMulticastFlowControl
Singleton instance which can be used to avoid allocation. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
close()
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.
-
Field Details
-
FC_PARAM_VALUE
URI param value to identify thisFlowControl
strategy.- See Also:
-
INSTANCE
Singleton instance which can be used to avoid allocation.
-
-
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 interfaceFlowControl
- Parameters:
context
- to allow access to media driver configurationcountersManager
- to use for any counters in use by the strategyudpChannel
- 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 interfaceAutoCloseable
- Specified by:
close
in interfaceFlowControl
-
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 interfaceFlowControl
- 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 interfaceFlowControl
- Parameters:
flyweight
- over the Status Message receivedreceiverAddress
- 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 interfaceFlowControl
- 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 interfaceFlowControl
- 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
Update the sender flow control strategy if an error comes from one of the receivers.- Specified by:
onError
in interfaceFlowControl
- 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 interfaceFlowControl
- 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 interfaceFlowControl
- 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.
-