Class ProcessFileLock

java.lang.Object
org.apache.jena.dboe.base.file.ProcessFileLock

public class ProcessFileLock extends Object
A simple packaging around a FileLock.

ProcessFileLocks are not reentrant locks.

See create(java.lang.String) and release(org.apache.jena.dboe.base.file.ProcessFileLock) to obtain and stop using a ProcessFileLock.

  • Method Details

    • create

      public static ProcessFileLock create(String filename)
      Create a ProcessFileLock using the named file. Locks are JVM-wide; each filename is associated with one lock object.
    • release

      public static void release(ProcessFileLock lockFile)
      Return the lock, unlocking the file if this process has it locked.
    • lockEx

      public void lockEx()
      Lock the file or throw DBOpEnvException.
      Throws:
      AlreadyLocked - if the lock is already held by this process.
    • lockWait

      public void lockWait()
      Lock the file or wait.
      Throws:
      AlreadyLocked - if the lock is already held by this process.
    • tryLock

      public boolean tryLock()
      Lock a file, return true on success else false.
      Throws:
      AlreadyLocked - if the lock is already held by this process.
    • unlock

      public void unlock()
      Release the lock - this must be paired with a "lock" operation.
      Throws:
      IllegalStateException - if the lock is not held by this process.
    • isLockedHere

      public boolean isLockedHere()
      Return true if this process holds the lock.
    • getPath

      public Path getPath()