com.vaadin.signals.impl.

Class AsynchronousSignalTree

java.lang.Object
com.vaadin.signals.impl.SignalTree
com.vaadin.signals.impl.AsynchronousSignalTree
public abstract class AsynchronousSignalTree extends SignalTree

A signal tree that submits commands to an event log and asynchronously waits for external confirmation before completing handling of the command. This means that submitted may contain changes that are not yet in confirmed and might never end up there if a concurrent change causes a conflict. This type of tree is intended for signals that are synchronized across a cluster.

  • Constructor Details

    • AsynchronousSignalTree

      protected AsynchronousSignalTree()

      Creates a new asynchronous signal tree.

  • Method Details

    • submit

      protected abstract void submit(List<SignalCommand> commands)

      Submits a sequence of commands to the event log. It is expected that the same sequence of commands will eventually be passed back to confirm(List).

      Parameters:

      commands - the list of commands to submit, not null

    • confirm

      public void confirm(List<SignalCommand> commands)

      Adds a sequence of commands to the confirmed snapshot. The commands might originate from this tree instance through submit(List) or from a different tree in the same cluster that uses the same underlying event log. Any remaining commands that have been submitted but not yet confirmed will be re-applied on top of the new confirmed state.

      Parameters:

      commands - the sequence of confirmed commands, not null

    • prepareCommit

      public SignalTree.PendingCommit prepareCommit(CommandsAndHandlers changes)

      Description copied from class: SignalTree

      Starts the process of committing a set of changes. The returned instance defines callbacks for continuing the commit procedure.

      Note that this method expects that the caller has acquired the tree lock prior to calling the method and that the lock will remain acquired while interacting with the returned object.

      Specified by:

      prepareCommit in class SignalTree

      Parameters:

      changes - the changes to commit, not null

      Returns:

      callbacks for coordinating the rest of the commit sequence, not null

    • confirmed

      public Snapshot confirmed()

      Description copied from class: SignalTree

      Gets the current snapshot based on all confirmed commands. This snapshot does not contain changes from commands that have been submitted but not yet confirmed.

      Specified by:

      confirmed in class SignalTree

      Returns:

      the confirmed snapshot, not null

    • submitted

      public Snapshot submitted()

      Description copied from class: SignalTree

      Gets the current snapshot based on all confirmed and submitted commands.

      Specified by:

      submitted in class SignalTree

      Returns:

      the submitted snapshot, not null