Class SimpleFSLockFactory.SimpleFSLock

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

    static final class SimpleFSLockFactory.SimpleFSLock
    extends Lock
    • Field Summary

      Fields 
      Modifier and Type Field Description
      private boolean closed  
      private java.nio.file.attribute.FileTime creationTime  
      private java.nio.file.Path path  
    • Constructor Summary

      Constructors 
      Constructor Description
      SimpleFSLock​(java.nio.file.Path path, java.nio.file.attribute.FileTime creationTime)  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void close()
      Releases exclusive access.
      void ensureValid()
      Best effort check that this lock is still valid.
      java.lang.String toString()  
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
    • Field Detail

      • path

        private final java.nio.file.Path path
      • creationTime

        private final java.nio.file.attribute.FileTime creationTime
      • closed

        private volatile boolean closed
    • Constructor Detail

      • SimpleFSLock

        SimpleFSLock​(java.nio.file.Path path,
                     java.nio.file.attribute.FileTime creationTime)
              throws java.io.IOException
        Throws:
        java.io.IOException
    • Method Detail

      • ensureValid

        public void ensureValid()
                         throws java.io.IOException
        Description copied from class: Lock
        Best effort check that this lock is still valid. Locks could become invalidated externally for a number of reasons, for example if a user deletes the lock file manually or when a network filesystem is in use.
        Specified by:
        ensureValid in class Lock
        Throws:
        java.io.IOException - if the lock is no longer valid.
      • close

        public void close()
                   throws java.io.IOException
        Description copied from class: Lock
        Releases exclusive access.

        Note that exceptions thrown from close may require human intervention, as it may mean the lock was no longer valid, or that fs permissions prevent removal of the lock file, or other reasons.

        Specified by:
        close in interface java.lang.AutoCloseable
        Specified by:
        close in interface java.io.Closeable
        Specified by:
        close in class Lock
        Throws:
        java.io.IOException
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object