Class LockBasedScheduler

  • All Implemented Interfaces:
    Scheduler

    public class LockBasedScheduler
    extends java.lang.Object
    implements Scheduler
    • Field Detail

      • head

        protected final java.util.concurrent.atomic.AtomicReference<SegmentNodeState> head
    • Method Detail

      • getHeadNodeState

        public org.apache.jackrabbit.oak.spi.state.NodeState getHeadNodeState()
        Description copied from interface: Scheduler
        Returns the latest state of the tree.
        Specified by:
        getHeadNodeState in interface Scheduler
        Returns:
        the latest state.
      • contentChanged

        protected void contentChanged​(org.apache.jackrabbit.oak.spi.state.NodeState root,
                                      org.apache.jackrabbit.oak.spi.commit.CommitInfo info)
      • schedule

        public org.apache.jackrabbit.oak.spi.state.NodeState schedule​(@NotNull
                                                                      @NotNull Commit commit,
                                                                      Scheduler.SchedulerOption... schedulingOptions)
                                                               throws org.apache.jackrabbit.oak.api.CommitFailedException
        Description copied from interface: Scheduler
        Schedule a commit. This method blocks until the changes in this commit have been processed and persisted. That is, until a call to Scheduler.getHeadNodeState() would return a node state reflecting those changes.
        Specified by:
        schedule in interface Scheduler
        Parameters:
        commit - the commit
        schedulingOptions - implementation specific scheduling options
        Throws:
        org.apache.jackrabbit.oak.api.CommitFailedException - if the commit failed and none of the changes have been applied.
      • checkpoint

        public java.lang.String checkpoint​(long lifetime,
                                           @NotNull
                                           @NotNull java.util.Map<java.lang.String,​java.lang.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 the NodeStore.checkpointInfo(String) method. Its semantics is entirely application specific.

        Specified by:
        checkpoint in interface Scheduler
        Parameters:
        lifetime - time (in milliseconds, > 0) that the checkpoint should remain available
        properties - properties to associate with the checkpoint
        Returns:
        string reference of this checkpoint
      • removeCheckpoint

        public boolean removeCheckpoint​(java.lang.String name)
        Description copied from interface: Scheduler
        Releases the provided checkpoint. If the provided checkpoint doesn't exist this method should return true.
        Specified by:
        removeCheckpoint in interface Scheduler
        Parameters:
        name - string reference of a checkpoint
        Returns:
        true if the checkpoint was successfully removed, or if it doesn't exist