Class ProcessFileLock

    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      static ProcessFileLock create​(java.lang.String filename)
      Create a ProcessFileLock using the named file.
      java.nio.file.Path getPath()  
      boolean isLockedHere()
      Return true if this process holds the lock.
      void lockEx()
      Lock the file or throw DBOpEnvException.
      void lockWait()
      Lock the file or wait.
      static void release​(ProcessFileLock lockFile)
      Return the lock, unlocking the file if this process has it locked.
      boolean tryLock()
      Lock a file, return true on success else false.
      void unlock()
      Release the lock - this must be paired with a "lock" operation.
      • Methods inherited from class java.lang.Object

        equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Method Detail

      • create

        public static ProcessFileLock create​(java.lang.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.
      • 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:
        java.lang.IllegalStateException - if the lock is not held by this process.
      • isLockedHere

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

        public java.nio.file.Path getPath()