public class LossDetector
extends java.lang.Object
implements io.aeron.logbuffer.TermGapScanner.GapHandler
This detector only notifies a single NAK at a time.
| Constructor and Description |
|---|
LossDetector(FeedbackDelayGenerator delayGenerator,
NakMessageSender nakMessageSender)
Create a loss handler for a channel.
|
| Modifier and Type | Method and Description |
|---|---|
void |
onGap(int termId,
org.agrona.concurrent.UnsafeBuffer buffer,
int offset,
int length) |
void |
onNak(long now,
int termId,
int termOffset)
Called on reception of a NAK
|
int |
rebuildOffset()
Get the offset to which the term is rebuilt after a
scan(UnsafeBuffer, long, long, long, int, int, int). |
int |
scan(org.agrona.concurrent.UnsafeBuffer termBuffer,
long rebuildPosition,
long hwmPosition,
long now,
int termLengthMask,
int positionBitsToShift,
int initialTermId)
Scan for gaps and handle received data.
|
public LossDetector(FeedbackDelayGenerator delayGenerator, NakMessageSender nakMessageSender)
delayGenerator - to use for delay determinationnakMessageSender - to call when sending a NAK is indicatedpublic int rebuildOffset()
scan(UnsafeBuffer, long, long, long, int, int, int).scan(UnsafeBuffer, long, long, long, int, int, int).public int scan(org.agrona.concurrent.UnsafeBuffer termBuffer,
long rebuildPosition,
long hwmPosition,
long now,
int termLengthMask,
int positionBitsToShift,
int initialTermId)
The handler keeps track from scan to scan what is a gap and what must have been repaired.
termBuffer - to scanrebuildPosition - to start scanning fromhwmPosition - to scan up tonow - time in nanosecondstermLengthMask - used for offset calculationpositionBitsToShift - used for position calculationinitialTermId - used by the scannerpublic void onNak(long now,
int termId,
int termOffset)
now - time in nanosecondstermId - in the NAKtermOffset - in the NAKpublic void onGap(int termId,
org.agrona.concurrent.UnsafeBuffer buffer,
int offset,
int length)
onGap in interface io.aeron.logbuffer.TermGapScanner.GapHandlerCopyright © 2014 - 2016 Real Logic Ltd. All Rights Reserved.