use of net.sourceforge.processdash.util.lock.FileConcurrencyLock in project processdash by dtuma.
the class LocalWorkingDirectory method acquireWriteLock.
public void acquireWriteLock(LockMessageHandler lockHandler, String ownerName) throws AlreadyLockedException, LockFailureException {
File lockFile = new File(targetDirectory, lockFilename);
writeLock = new FileConcurrencyLock(lockFile);
writeLock.setListenForLostLock(shouldMonitorWriteLock(lockFile));
writeLock.setApprover(this);
writeLock.acquireLock(null, lockHandler, ownerName);
}
use of net.sourceforge.processdash.util.lock.FileConcurrencyLock in project processdash by dtuma.
the class MigrationToolIndiv method loadData.
private void loadData() {
changesWritten = false;
targetDir = new File(System.getProperty(TARGET_DIR));
projectPath = System.getProperty(PROJECT_PATH);
if (!projectPath.startsWith("/"))
projectPath = "/" + projectPath;
migrationNeeded = Boolean.getBoolean(MIGRATION_NEEDED);
processID = System.getProperty(PROCESS_ID);
targetPID = System.getProperty(TARGET_PROCESS_ID);
conversionNeeded = hasValue(targetPID) && !targetPID.equals(processID);
phases = Arrays.asList(System.getProperty(PHASE_LIST).split("/"));
fileLock = new FileConcurrencyLock(file(DashboardInstanceStrategy.LOCK_FILE_NAME));
fileLock.setListenForLostLock(false);
}
use of net.sourceforge.processdash.util.lock.FileConcurrencyLock in project processdash by dtuma.
the class MoveProjectWorker method lockOldDataDirectory.
/*
* Methods to lock and unlock the old data directory
*/
private void lockOldDataDirectory() throws MoveProjectException {
File lockFile = new File(oldTeamDataDir, LOCK_FILE);
fileLock = new FileConcurrencyLock(lockFile);
try {
fileLock.acquireLock(null);
} catch (AlreadyLockedException ale) {
throw new MoveProjectException("teamDirInUse").append("lockOwner", ale.getExtraInfo());
} catch (LockFailureException e) {
throw new MoveProjectException("teamDirInUse");
}
}
Aggregations