Interface LockingService


public interface LockingService
  • Method Summary

    Modifier and Type
    Method
    Description
    boolean
    isLockOwner(Object entityId, Principal principal)
    Return true if the given principal holds the lock for the given entity.
    boolean
    lock(Object entityId, Principal principal)
    Locks the given entity for the given principal.
    lockOwner(Object entityId)
    Returns the lock owner, or null if not locked
    boolean
    unlock(Object entityId, Principal principal)
    Unlocks the given entity for the current principal.
  • Method Details

    • lock

      boolean lock(Object entityId, Principal principal)
      Locks the given entity for the given principal. If no lock exists for the given entity then the lock will be obtained.
      Parameters:
      entityId - the entity to lock
      principal - the lock owner
      Returns:
      true if lock succeeds, otherwise false
    • unlock

      boolean unlock(Object entityId, Principal principal)
      Unlocks the given entity for the current principal. If the current principal holds the lock it will be released.
      Parameters:
      entityId - the entity to unlock
      principal - the lock owner
      Returns:
      true if unlock succeeds, otherwise false
    • isLockOwner

      boolean isLockOwner(Object entityId, Principal principal)
      Return true if the given principal holds the lock for the given entity.
      Parameters:
      entityId - the entity with the lock
      principal - the principal
      Returns:
      true if the given principal holds the lock for the given entity
    • lockOwner

      Principal lockOwner(Object entityId)
      Returns the lock owner, or null if not locked
      Parameters:
      entityId - the entity with the lock
      Returns:
      lock owner