Search in sources :

Example 1 with FileConcurrencyLock

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);
}
Also used : FileConcurrencyLock(net.sourceforge.processdash.util.lock.FileConcurrencyLock) File(java.io.File)

Example 2 with FileConcurrencyLock

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);
}
Also used : FileConcurrencyLock(net.sourceforge.processdash.util.lock.FileConcurrencyLock) File(java.io.File)

Example 3 with FileConcurrencyLock

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");
    }
}
Also used : AlreadyLockedException(net.sourceforge.processdash.util.lock.AlreadyLockedException) FileConcurrencyLock(net.sourceforge.processdash.util.lock.FileConcurrencyLock) File(java.io.File) LockFailureException(net.sourceforge.processdash.util.lock.LockFailureException)

Aggregations

File (java.io.File)3 FileConcurrencyLock (net.sourceforge.processdash.util.lock.FileConcurrencyLock)3 AlreadyLockedException (net.sourceforge.processdash.util.lock.AlreadyLockedException)1 LockFailureException (net.sourceforge.processdash.util.lock.LockFailureException)1