/** * Determines if the directory is locked. * * @return <code>true</code> if the directory is already locked. */ @Override public boolean isLocked() { return getLockDir().exists(); }
/** * Determines if the directory is locked. * * @return <code>true</code> if the directory is already locked. */ @Override public boolean isLocked() { return getLockDir().exists(); }
/** * Revokes a lock owned by another process. * * @return <code>true</code> if a lock was successfully revoked. */ @Override public boolean revokeLock() { File lockDir = getLockDir(); File lockedFile = new File(lockDir, LOCK_FILE_NAME); File infoFile = new File(lockDir, INFO_FILE_NAME); lockedFile.delete(); infoFile.delete(); return lockDir.delete(); }
/** * Revokes a lock owned by another process. * * @return <code>true</code> if a lock was successfully revoked. */ @Override public boolean revokeLock() { File lockDir = getLockDir(); File lockedFile = new File(lockDir, LOCK_FILE_NAME); File infoFile = new File(lockDir, INFO_FILE_NAME); lockedFile.delete(); infoFile.delete(); return lockDir.delete(); }
private String getLockedBy() { try { File lockDir = getLockDir(); File infoFile = new File(lockDir, INFO_FILE_NAME); BufferedReader reader = new BufferedReader(new FileReader(infoFile)); try { return reader.readLine(); } finally { reader.close(); } } catch (IOException e) { logger.warn(e.toString(), e); return null; } }
private String getLockedBy() { try { File lockDir = getLockDir(); File infoFile = new File(lockDir, INFO_FILE_NAME); BufferedReader reader = new BufferedReader(new FileReader(infoFile)); try { return reader.readLine(); } finally { reader.close(); } } catch (IOException e) { logger.warn(e.toString(), e); return null; } }
File lockDir = getLockDir();
File lockDir = getLockDir();