Package org.eclipse.rdf4j.sail.helpers

## Class DirectoryLockManager

- java.lang.Object
- - org.eclipse.rdf4j.sail.helpers.DirectoryLockManager

- All Implemented Interfaces:
    `LockManager`

      public class DirectoryLockManager
      extends Object
      implements LockManager

  Used to create a lock in a directory.
  Author:
    James Leigh, Arjohn Kampman

- - ### Constructor Summary

    Constructors
    Constructor | Description
    --- | ---
    `DirectoryLockManager​(File dir)` |

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method | Description
    --- | --- | ---
    `String` | `getLocation()` | Technical description of where the lock is located, such as a URL.
    `boolean` | `isLocked()` | Determines if the directory is locked.
    `Lock` | `lockOrFail()` | Creates a lock in a directory if it does not yet exist.
    `boolean` | `revokeLock()` | Revokes a lock owned by another process.
    `Lock` | `tryLock()` | Creates a lock in a directory if it does not yet exist.

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Constructor Detail

    - #### DirectoryLockManager

          public DirectoryLockManager​(File dir)

  - ### Method Detail

    - #### getLocation

          public String getLocation()

      Description copied from interface: `LockManager`
      Technical description of where the lock is located, such as a URL.
      Specified by:
        `getLocation` in interface `LockManager`

    - #### isLocked

          public boolean isLocked()

      Determines if the directory is locked.
      Specified by:
        `isLocked` in interface `LockManager`
      Returns:
        `true` if the directory is already locked.

    - #### tryLock

          public Lock tryLock()

      Creates a lock in a directory if it does not yet exist.
      Specified by:
        `tryLock` in interface `LockManager`
      Returns:
        a newly acquired lock or null if the directory is already locked.

    - #### lockOrFail

          public Lock lockOrFail()
                          throws SailLockedException

      Creates a lock in a directory if it does not yet exist.
      Specified by:
        `lockOrFail` in interface `LockManager`
      Returns:
        a newly acquired lock.
      Throws:
        `SailLockedException` - if the directory is already locked.

    - #### revokeLock

          public boolean revokeLock()

      Revokes a lock owned by another process.
      Specified by:
        `revokeLock` in interface `LockManager`
      Returns:
        `true` if a lock was successfully revoked.