Class LockBasedScheduler
- java.lang.Object
-
- org.apache.jackrabbit.oak.segment.scheduler.LockBasedScheduler
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
LockBasedScheduler.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.LockBasedSchedulerBuilder
builder(@NotNull Revisions revisions, @NotNull SegmentReader reader, @NotNull SegmentNodeStoreStats stats)
String
checkpoint(long lifetime, @NotNull Map<String,String> properties)
Creates a new checkpoint of the latest root of the tree.protected void
contentChanged(NodeState root, CommitInfo info)
NodeState
getHeadNodeState()
Returns the latest state of the tree.boolean
removeCheckpoint(String name)
Releases the provided checkpoint.NodeState
schedule(@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:Scheduler
Returns the latest state of the tree.- Specified by:
getHeadNodeState
in 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:Scheduler
Schedule acommit
. This method blocks until the changes in thiscommit
have been processed and persisted. That is, until a call toScheduler.getHeadNodeState()
would return a node state reflecting those changes.- Specified by:
schedule
in 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:Scheduler
Creates 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
properties
passed 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:
checkpoint
in 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:Scheduler
Releases the provided checkpoint. If the provided checkpoint doesn't exist this method should returntrue
.- Specified by:
removeCheckpoint
in interfaceScheduler
- Parameters:
name
- string reference of a checkpoint- Returns:
true
if the checkpoint was successfully removed, or if it doesn't exist
-
-