Class LockBasedScheduler
- java.lang.Object
-
- org.apache.jackrabbit.oak.segment.scheduler.LockBasedScheduler
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classLockBasedScheduler.LockBasedSchedulerBuilder-
Nested classes/interfaces inherited from interface org.apache.jackrabbit.oak.segment.scheduler.Scheduler
Scheduler.SchedulerOption
-
-
Field Summary
Fields Modifier and Type Field Description protected AtomicReference<SegmentNodeState>head
-
Constructor Summary
Constructors Constructor Description LockBasedScheduler(LockBasedScheduler.LockBasedSchedulerBuilder builder)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static LockBasedScheduler.LockBasedSchedulerBuilderbuilder(@NotNull Revisions revisions, @NotNull SegmentReader reader, @NotNull SegmentNodeStoreStats stats)Stringcheckpoint(long lifetime, @NotNull Map<String,String> properties)Creates a new checkpoint of the latest root of the tree.protected voidcontentChanged(NodeState root, CommitInfo info)NodeStategetHeadNodeState()Returns the latest state of the tree.booleanremoveCheckpoint(String name)Releases the provided checkpoint.NodeStateschedule(@NotNull Commit commit, Scheduler.SchedulerOption... schedulingOptions)Schedule acommit.
-
-
-
Field Detail
-
head
protected final AtomicReference<SegmentNodeState> head
-
-
Constructor Detail
-
LockBasedScheduler
public LockBasedScheduler(LockBasedScheduler.LockBasedSchedulerBuilder builder)
-
-
Method Detail
-
builder
public static LockBasedScheduler.LockBasedSchedulerBuilder builder(@NotNull @NotNull Revisions revisions, @NotNull @NotNull SegmentReader reader, @NotNull @NotNull SegmentNodeStoreStats stats)
-
getHeadNodeState
public NodeState getHeadNodeState()
Description copied from interface:SchedulerReturns the latest state of the tree.- Specified by:
getHeadNodeStatein interfaceScheduler- Returns:
- the latest state.
-
contentChanged
protected void contentChanged(NodeState root, CommitInfo info)
-
schedule
public NodeState schedule(@NotNull @NotNull Commit commit, Scheduler.SchedulerOption... schedulingOptions) throws CommitFailedException
Description copied from interface:SchedulerSchedule acommit. This method blocks until the changes in thiscommithave been processed and persisted. That is, until a call toScheduler.getHeadNodeState()would return a node state reflecting those changes.- Specified by:
schedulein interfaceScheduler- Parameters:
commit- the commitschedulingOptions- implementation specific scheduling options- Throws:
CommitFailedException- if the commit failed and none of the changes have been applied.
-
checkpoint
public String checkpoint(long lifetime, @NotNull @NotNull Map<String,String> properties)
Description copied from interface:SchedulerCreates a new checkpoint of the latest root of the tree. The checkpoint remains valid for at least as long as requested and allows that state of the repository to be retrieved using the returned opaque string reference.The
propertiespassed to this methods are associated with the checkpoint and can be retrieved through theNodeStore.checkpointInfo(String)method. Its semantics is entirely application specific.- Specified by:
checkpointin interfaceScheduler- Parameters:
lifetime- time (in milliseconds, > 0) that the checkpoint should remain availableproperties- properties to associate with the checkpoint- Returns:
- string reference of this checkpoint
-
removeCheckpoint
public boolean removeCheckpoint(String name)
Description copied from interface:SchedulerReleases the provided checkpoint. If the provided checkpoint doesn't exist this method should returntrue.- Specified by:
removeCheckpointin interfaceScheduler- Parameters:
name- string reference of a checkpoint- Returns:
trueif the checkpoint was successfully removed, or if it doesn't exist
-
-