public class LossDetector extends java.lang.Object implements TermGapScanner.GapHandler
Each detector only notifies a single run of a gap in a message stream.
| Constructor and Description |
|---|
LossDetector(FeedbackDelayGenerator delayGenerator,
LossHandler lossHandler)
Create a loss detector for a channel.
|
| Modifier and Type | Method and Description |
|---|---|
static boolean |
lossFound(long scanOutcome)
Has loss been found in the scan?
|
void |
onGap(int termId,
int offset,
int length)
Gap detected in log buffer that is being rebuilt.
|
static long |
pack(int rebuildOffset,
boolean lossFound)
Pack the values for workCount and rebuildOffset into a long for returning on the stack.
|
static int |
rebuildOffset(long scanOutcome)
The offset up to which the log has been rebuilt.
|
long |
scan(org.agrona.concurrent.UnsafeBuffer termBuffer,
long rebuildPosition,
long hwmPosition,
long nowNs,
int termLengthMask,
int positionBitsToShift,
int initialTermId)
Scan for gaps and handle received data.
|
public LossDetector(FeedbackDelayGenerator delayGenerator, LossHandler lossHandler)
delayGenerator - to use for delay determinationlossHandler - to call when signalling a gappublic long scan(org.agrona.concurrent.UnsafeBuffer termBuffer,
long rebuildPosition,
long hwmPosition,
long nowNs,
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 tonowNs - time in nanosecondstermLengthMask - used for offset calculationpositionBitsToShift - used for position calculationinitialTermId - used by the scannerpublic void onGap(int termId,
int offset,
int length)
TermGapScanner.GapHandleronGap in interface TermGapScanner.GapHandlertermId - active term being scanned.offset - at which the gap begins.length - of the gap in bytes.public static long pack(int rebuildOffset,
boolean lossFound)
rebuildOffset - value to be packed.lossFound - value to be packed.public static boolean lossFound(long scanOutcome)
scanOutcome - into which the fragments read value has been packed.public static int rebuildOffset(long scanOutcome)
scanOutcome - into which the offset value has been packed.Copyright © 2014-2018 Real Logic Ltd. All Rights Reserved.