/** * Returns a new instance of {@link GridFileLock}, that * can be used to synchronize on a lock file, which resides * in a temporary directory. * <p> * If a lock file does not exist, it is created. * <p> * If a temporary directory does not exist, an exception is * thrown. * * @return An file lock instance. Calling {@link GridFileLock#lock()} * will perform actual locking. * @throws RuntimeException If a temporary directory is not found. */ public static GridFileLock fileLock() { try { return new GridFileLock(LOCK_FILE); } catch (FileNotFoundException e) { throw new RuntimeException("tmp.dir not found", e); } } }