public class CheckpointRecord
extends java.lang.Object
Rollbackable
is monitored by a
checkpoint object at a time. The Rollbackable
object maintains a
record for its checkpoint objects. When a new checkpoint object is assigned,
the old one is pushed to the checkpoint record. When a rollback is issued
beyond the time when the last checkpoint object was assigned, the previous
checkpoint object is then assigned back to the Rollbackable
.
This record for checkpoint objects is basically a stack, with the top
element as the last assigned checkpoint object (the checkpoint object that
currently monitors a Rollbackable
).
Red (tfeng) |
Red (tfeng) |
Constructor and Description |
---|
CheckpointRecord() |
Modifier and Type | Method and Description |
---|---|
void |
add(Checkpoint checkpoint,
long timestamp)
Add a checkpoint object to the top of this record, associating with it
a timestamp.
|
void |
commit(long timestamp)
Commit the changes of checkpoint objects up to (but not including) the
time given by the timestamp.
|
long |
getTopTimestamp()
Get the timestamp associated with the checkpoint object on top of the
stack.
|
Checkpoint |
restore(Checkpoint checkpoint,
Rollbackable object,
long timestamp,
boolean trim)
Restore the old checkpoint object to the given
Rollbackable
object, if the given timestamp is less than or equal to the timestamp
associated with the current checkpoint object. |
public void add(Checkpoint checkpoint, long timestamp)
When a rollback beyond this timestamp is issued later, the previous checkpoint object is restored.
checkpoint
- The checkpoint object to be push to the top of this
record.timestamp
- The current timestamp of the new checkpoint object.public void commit(long timestamp)
timestamp
- The timestamp specifying the time up to when the
changes of checkpoint objects are committed.public long getTopTimestamp()
public Checkpoint restore(Checkpoint checkpoint, Rollbackable object, long timestamp, boolean trim)
Rollbackable
object, if the given timestamp is less than or equal to the timestamp
associated with the current checkpoint object.
This method is not meant to be called by user applications.
checkpoint
- The checkpoint object of the Rollbackable
object.object
- The Rollbackable
object.timestamp
- The timestamp.trim
- Whether to delete the used checkpoint object record.Rollbackable
object after
it is restored.