public class LocalCheckpointTracker
extends java.lang.Object
Constructor | Description |
---|---|
LocalCheckpointTracker(long maxSeqNo,
long localCheckpoint) |
Initialize the local checkpoint service.
|
Modifier and Type | Method | Description |
---|---|---|
long |
generateSeqNo() |
Issue the next sequence number.
|
long |
getCheckpoint() |
The current checkpoint which can be advanced by
markSeqNoAsCompleted(long) . |
long |
getMaxSeqNo() |
The maximum sequence number issued so far.
|
SeqNoStats |
getStats(long globalCheckpoint) |
constructs a
SeqNoStats object, using local state and the supplied global checkpoint
This is needed to make sure the local checkpoint and max seq no are consistent |
void |
markSeqNoAsCompleted(long seqNo) |
Marks the processing of the provided sequence number as completed as updates the checkpoint if possible.
|
void |
resetCheckpoint(long checkpoint) |
Resets the checkpoint to the specified value.
|
void |
waitForOpsToComplete(long seqNo) |
Waits for all operations up to the provided sequence number to complete.
|
public LocalCheckpointTracker(long maxSeqNo, long localCheckpoint)
maxSeqNo
should be set to the last sequence number assigned, or
SequenceNumbers.NO_OPS_PERFORMED
and localCheckpoint
should be set to the last known local checkpoint,
or SequenceNumbers.NO_OPS_PERFORMED
.maxSeqNo
- the last sequence number assigned, or SequenceNumbers.NO_OPS_PERFORMED
localCheckpoint
- the last known local checkpoint, or SequenceNumbers.NO_OPS_PERFORMED
public long generateSeqNo()
public void markSeqNoAsCompleted(long seqNo)
seqNo
- the sequence number to mark as completedpublic void resetCheckpoint(long checkpoint)
checkpoint
- the local checkpoint to reset this tracker topublic long getCheckpoint()
markSeqNoAsCompleted(long)
.public long getMaxSeqNo()
public SeqNoStats getStats(long globalCheckpoint)
SeqNoStats
object, using local state and the supplied global checkpoint
This is needed to make sure the local checkpoint and max seq no are consistentpublic void waitForOpsToComplete(long seqNo) throws java.lang.InterruptedException
seqNo
- the sequence number that the checkpoint must advance to before this method returnsjava.lang.InterruptedException
- if the thread was interrupted while blocking on the condition