Class FileLockHolder

    • Constructor Detail

      • FileLockHolder

        protected FileLockHolder​(String rootDir,
                                 IgniteLogger log)
        Parameters:
        rootDir - Root directory for lock file.
        log - Log.
    • Method Detail

      • lockInfo

        public abstract String lockInfo()
        This info will appear in error message of concurrent processes that will try to lock on the same file.
        Returns:
        Lock info to store in the file.
      • warningMessage

        protected abstract String warningMessage​(String lockInfo)
        Parameters:
        lockInfo - Existing lock info.
        Returns:
        Warning message.
      • tryLock

        public void tryLock​(long lockWaitTimeMillis)
                     throws IgniteCheckedException
        Parameters:
        lockWaitTimeMillis - During which time thread will try capture file lock.
        Throws:
        IgniteCheckedException - If failed to capture file lock.
      • isLocked

        public boolean isLocked()
        Locked or not.
      • release

        public void release()
        Releases file lock
      • close

        public void close()
        Closes file channel
        Specified by:
        close in interface AutoCloseable
      • lockPath

        public String lockPath()
        Returns:
        Absolute path to lock file.