Class LockFile

  • All Implemented Interfaces:
    java.io.Closeable, java.lang.AutoCloseable

    public class LockFile
    extends java.lang.Object
    implements java.io.Closeable
    Creates and deletes lock files.
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void close()
      Releases the lock file.
      static LockFile lock​(java.nio.file.Path lockFile)
      Creates a lock file.
      • Methods inherited from class java.lang.Object

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

      • lock

        public static LockFile lock​(java.nio.file.Path lockFile)
                             throws java.io.IOException
        Creates a lock file.
        Parameters:
        lockFile - the path of the lock file
        Returns:
        a new LockFile that can be released later
        Throws:
        java.io.IOException - if creating the lock file fails
      • close

        public void close()
        Releases the lock file.
        Specified by:
        close in interface java.lang.AutoCloseable
        Specified by:
        close in interface java.io.Closeable