Class LockableFile.NioFileLock

  • All Implemented Interfaces:
    LockableFile.InterProcessLock
    Enclosing class:
    LockableFile

    private class LockableFile.NioFileLock
    extends java.lang.Object
    implements LockableFile.InterProcessLock
    This is the recommended way to lock a file system wide (across multiple processes).

    Unfortunately this causes problems during unlocking in Windows. https://bugs.java.com/bugdatabase/view_bug.do?bug_id=4715154

    • Field Summary

      Fields 
      Modifier and Type Field Description
      private java.nio.channels.FileChannel fileChannel  
      private java.nio.channels.FileLock fileLock  
      private java.io.RandomAccessFile randomAccessFile  
    • Constructor Summary

      Constructors 
      Modifier Constructor Description
      private NioFileLock()  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void lock()  
      boolean tryLock()  
      void unlock()  
      • Methods inherited from class java.lang.Object

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

      • randomAccessFile

        private java.io.RandomAccessFile randomAccessFile
      • fileChannel

        private java.nio.channels.FileChannel fileChannel
      • fileLock

        private java.nio.channels.FileLock fileLock
    • Constructor Detail

      • NioFileLock

        private NioFileLock()