Interface ConflictWatcher

All Known Implementing Classes:
ConflictWatcherImpl

public interface ConflictWatcher
Detects if a repository object was modified in an unexpected way, typically by a different thread. Unlike VersionPrecondition, this is not used to prevent modifications, but rather to detect that they happened and so the caller can later act upon it. A watcher is connected to a single object, specified at the creation time. See getOid().
See Also:
  • Method Summary

    Modifier and Type
    Method
    Description
    int
    What is the version we are currently expected?
    @NotNull String
    OID of the object this watcher is watching.
    boolean
    Was a conflict detected on the object by this watcher?
    boolean
    true if the watcher was initialized, so it actually detects the conflicts.
    void
    Tells the watcher to expect given version of the object being watched.
  • Method Details

    • getOid

      @NotNull @NotNull String getOid()
      OID of the object this watcher is watching.
    • hasConflict

      boolean hasConflict()
      Was a conflict detected on the object by this watcher?
    • setExpectedVersion

      void setExpectedVersion(String version)
      Tells the watcher to expect given version of the object being watched. Calling this method is optional: If expected version is not provided, it will be determined automatically e.g. on the first MODIFY operation.
    • isInitialized

      boolean isInitialized()
      true if the watcher was initialized, so it actually detects the conflicts.
    • getExpectedVersion

      int getExpectedVersion()
      What is the version we are currently expected? Relevant only if isInitialized() is true. NOTE: This is a bit of encapsulation breakage. The conflict detection may be based on things other that the object version. However, for some reason, we (probably temporarily) need this information.