Interface IResourceLocks

All Known Implementing Classes:
ResourceLocks

public interface IResourceLocks
  • Method Details

    • lock

      boolean lock(ITransaction transaction, String path, String owner, boolean exclusive, int depth, int timeout, boolean temporary) throws LockFailedException
      Tries to lock the resource at "path".
      Parameters:
      transaction - the transaction
      path - what resource to lock
      owner - the owner of the lock
      exclusive - if the lock should be exclusive (or shared)
      depth - depth
      timeout - lock duration in seconds.
      Returns:
      true if the resource at path was successfully locked, false if an existing lock prevented this
      Throws:
      LockFailedException - if the lock failed
    • unlock

      boolean unlock(ITransaction transaction, String id, String owner)
      Unlocks all resources at "path" (and all sub-folders if existing) that have the same owner.
      Parameters:
      transaction - the transaction
      id - id to the resource to unlock
      owner - who wants to unlock
    • unlockTemporaryLockedObjects

      void unlockTemporaryLockedObjects(ITransaction transaction, String path, String owner)
      Unlocks all resources at "path" (and all sub-folders if existing) that have the same owner.
      Parameters:
      transaction - the transaction
      path - what resource to unlock
      owner - who wants to unlock
    • checkTimeouts

      void checkTimeouts(ITransaction transaction, boolean temporary)
      Deletes LockedObjects, where timeout has reached.
      Parameters:
      transaction - the transaction
      temporary - check timeout on temporary or real locks
    • exclusiveLock

      boolean exclusiveLock(ITransaction transaction, String path, String owner, int depth, int timeout) throws LockFailedException
      Tries to lock the resource at "path" exclusively.
      Parameters:
      transaction - the transaction
      path - what resource to lock
      owner - the owner of the lock
      depth - depth
      timeout - lock duration in seconds.
      Returns:
      true if the resource at path was successfully locked, false if an existing lock prevented this
      Throws:
      LockFailedException - if the lock failed
    • sharedLock

      boolean sharedLock(ITransaction transaction, String path, String owner, int depth, int timeout) throws LockFailedException
      Tries to lock the resource at "path" shared.
      Parameters:
      transaction - the transaction
      path - what resource to lock
      owner - the owner of the lock
      depth - depth
      timeout - lock Duration in seconds.
      Returns:
      true if the resource at path was successfully locked, false if an existing lock prevented this
      Throws:
      LockFailedException - if the lock failed
    • getLockedObjectByID

      LockedObject getLockedObjectByID(ITransaction transaction, String id)
      Gets the LockedObject corresponding to specified id.
      Parameters:
      transaction - the transaction
      id - lock token to requested resource
      Returns:
      LockedObject or null if no LockedObject on specified path exists
    • getLockedObjectByPath

      LockedObject getLockedObjectByPath(ITransaction transaction, String path)
      Gets the locked object on specified path.
      Parameters:
      transaction - the transaction
      path - the path to requested resource
      Returns:
      LockedObject or null if no LockedObject on specified path exists
    • getTempLockedObjectByID

      LockedObject getTempLockedObjectByID(ITransaction transaction, String id)
      Gets the LockedObject corresponding to specified id (lock token).
      Parameters:
      transaction - the transaction
      id - the lock token to requested resource
      Returns:
      LockedObject or null if no LockedObject on specified path exists
    • getTempLockedObjectByPath

      LockedObject getTempLockedObjectByPath(ITransaction transaction, String path)
      Gets the LockedObject on specified path.
      Parameters:
      transaction - the transaction
      path - path to requested resource
      Returns:
      LockedObject or null if no LockedObject on specified path exists