Interface IResourceLocks

  • All Known Implementing Classes:
    ResourceLocks

    public interface IResourceLocks
    • Method Detail

      • lock

        boolean lock​(Transaction transaction,
                     String path,
                     String owner,
                     boolean exclusive,
                     int depth,
                     int timeout,
                     boolean temporary)
        Tries to lock the resource at "path".
        Parameters:
        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
      • unlock

        boolean unlock​(Transaction transaction,
                       String id,
                       String owner)
        Unlocks all resources at "path" (and all subfolders if existing)

        that have the same owner.

        Parameters:
        transaction -
        id - id to the resource to unlock
        owner - who wants to unlock
      • unlockTemporaryLockedObjects

        void unlockTemporaryLockedObjects​(Transaction transaction,
                                          String path,
                                          String owner)
        Unlocks all resources at "path" (and all subfolders if existing)

        that have the same owner.

        Parameters:
        transaction -
        path - what resource to unlock
        owner - who wants to unlock
      • checkTimeouts

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

        boolean exclusiveLock​(Transaction transaction,
                              String path,
                              String owner,
                              int depth,
                              int timeout)
        Tries to lock the resource at "path" exclusively.
        Parameters:
        transaction - 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
      • sharedLock

        boolean sharedLock​(Transaction transaction,
                           String path,
                           String owner,
                           int depth,
                           int timeout)
        Tries to lock the resource at "path" shared.
        Parameters:
        transaction - 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
      • getLockedObjectByID

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

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

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

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