Search in sources :

Example 1 with ProfTimer

use of net.sourceforge.processdash.util.ProfTimer in project processdash by dtuma.

the class FileBackupManager method maybeRun.

public void maybeRun(int when, String who) {
    if (Settings.isReadOnly())
        return;
    if (loggingEnabled() && when == SHUTDOWN)
        stopLogging();
    if (Settings.getBool("backup.enabled", true)) {
        ProfTimer pt = new ProfTimer(FileBackupManager.class, "FileBackupManager.run");
        try {
            runImpl(when, who, false);
        } catch (Throwable t) {
        }
        pt.click("Finished backup");
    }
    if (loggingEnabled() && when == STARTUP)
        startLogging(workingDirectory.getDirectory());
}
Also used : ProfTimer(net.sourceforge.processdash.util.ProfTimer)

Example 2 with ProfTimer

use of net.sourceforge.processdash.util.ProfTimer in project processdash by dtuma.

the class ResourceBridgeClient method pingLock.

public synchronized void pingLock() throws LockFailureException {
    if (userName == null)
        throw new NotLockedException();
    ProfTimer pt = new ProfTimer(logger, "ResourceBridgeClient.pingLock[" + remoteUrl + "]");
    try {
        doLockPostRequest(PING_LOCK_ACTION);
        pt.click("Pinged bridged lock");
    } catch (LockFailureException lfe) {
        throw lfe;
    } catch (Exception e) {
        throw new LockUncertainException(e);
    }
}
Also used : ProfTimer(net.sourceforge.processdash.util.ProfTimer) NotLockedException(net.sourceforge.processdash.util.lock.NotLockedException) LockUncertainException(net.sourceforge.processdash.util.lock.LockUncertainException) LockFailureException(net.sourceforge.processdash.util.lock.LockFailureException) LockFailureException(net.sourceforge.processdash.util.lock.LockFailureException) LockUncertainException(net.sourceforge.processdash.util.lock.LockUncertainException) NotLockedException(net.sourceforge.processdash.util.lock.NotLockedException) IOException(java.io.IOException) HttpException(net.sourceforge.processdash.util.HttpException) AlreadyLockedException(net.sourceforge.processdash.util.lock.AlreadyLockedException)

Example 3 with ProfTimer

use of net.sourceforge.processdash.util.ProfTimer in project processdash by dtuma.

the class ResourceBridgeClient method resumeOfflineLock.

/**
     * Reassert a lock that was enabled for offline use during a previous
     * session.
     * 
     * If the lock could be reobtained, this will return successfully - even if
     * the lock is no longer enabled for offline use. After calling this method,
     * clients should call {@link #getOfflineLockStatus()} to ensure that the
     * lock is in the mode they expect.
     */
public synchronized void resumeOfflineLock(String userName) throws LockFailureException {
    if (!StringUtils.hasValue(extraLockData))
        throw new IllegalStateException("No extra lock data has been set");
    ProfTimer pt = new ProfTimer(logger, "ResourceBridgeClient.resumeOfflineLock[" + remoteUrl + "]");
    try {
        this.userName = userName;
        doLockPostRequest(ASSERT_LOCK_ACTION);
        pt.click("Resumed offline bridged lock");
    } catch (LockFailureException lfe) {
        this.userName = null;
        throw lfe;
    } catch (Exception e) {
        // when operating in offline mode, it is not unusual for the server
        // to be unreachable, which could result in IOExceptions or other
        // errors.  Give caller the benefit of the doubt and mark the lock
        // as offline; then continue normally.
        setOfflineLockStatus(OfflineLockStatus.Enabled);
    }
}
Also used : ProfTimer(net.sourceforge.processdash.util.ProfTimer) LockFailureException(net.sourceforge.processdash.util.lock.LockFailureException) LockFailureException(net.sourceforge.processdash.util.lock.LockFailureException) LockUncertainException(net.sourceforge.processdash.util.lock.LockUncertainException) NotLockedException(net.sourceforge.processdash.util.lock.NotLockedException) IOException(java.io.IOException) HttpException(net.sourceforge.processdash.util.HttpException) AlreadyLockedException(net.sourceforge.processdash.util.lock.AlreadyLockedException)

Example 4 with ProfTimer

use of net.sourceforge.processdash.util.ProfTimer in project processdash by dtuma.

the class ResourceBridgeClient method doAssertLock.

private synchronized void doAssertLock(String action) throws LockFailureException {
    if (userName == null)
        throw new NotLockedException();
    ProfTimer pt = new ProfTimer(logger, "ResourceBridgeClient." + action + "[" + remoteUrl + "]");
    try {
        doLockPostRequest(action);
        pt.click("Asserted bridged lock");
    } catch (LockFailureException lfe) {
        throw lfe;
    } catch (Exception e) {
        throw new LockUncertainException(e);
    }
}
Also used : ProfTimer(net.sourceforge.processdash.util.ProfTimer) NotLockedException(net.sourceforge.processdash.util.lock.NotLockedException) LockUncertainException(net.sourceforge.processdash.util.lock.LockUncertainException) LockFailureException(net.sourceforge.processdash.util.lock.LockFailureException) LockFailureException(net.sourceforge.processdash.util.lock.LockFailureException) LockUncertainException(net.sourceforge.processdash.util.lock.LockUncertainException) NotLockedException(net.sourceforge.processdash.util.lock.NotLockedException) IOException(java.io.IOException) HttpException(net.sourceforge.processdash.util.HttpException) AlreadyLockedException(net.sourceforge.processdash.util.lock.AlreadyLockedException)

Example 5 with ProfTimer

use of net.sourceforge.processdash.util.ProfTimer in project processdash by dtuma.

the class ResourceBridgeClient method acquireLock.

public synchronized void acquireLock(String userName) throws LockFailureException {
    ProfTimer pt = new ProfTimer(logger, "ResourceBridgeClient.acquireLock[" + remoteUrl + "]");
    try {
        this.userName = userName;
        doLockPostRequest(ACQUIRE_LOCK_ACTION);
        pt.click("Acquired bridged lock");
    } catch (LockFailureException lfe) {
        this.userName = null;
        throw lfe;
    } catch (Exception e) {
        this.userName = null;
        setOfflineLockStatus(OfflineLockStatus.NotLocked);
        throw new LockFailureException(e);
    }
}
Also used : ProfTimer(net.sourceforge.processdash.util.ProfTimer) LockFailureException(net.sourceforge.processdash.util.lock.LockFailureException) LockFailureException(net.sourceforge.processdash.util.lock.LockFailureException) LockUncertainException(net.sourceforge.processdash.util.lock.LockUncertainException) NotLockedException(net.sourceforge.processdash.util.lock.NotLockedException) IOException(java.io.IOException) HttpException(net.sourceforge.processdash.util.HttpException) AlreadyLockedException(net.sourceforge.processdash.util.lock.AlreadyLockedException)

Aggregations

ProfTimer (net.sourceforge.processdash.util.ProfTimer)12 IOException (java.io.IOException)6 LockFailureException (net.sourceforge.processdash.util.lock.LockFailureException)6 NotLockedException (net.sourceforge.processdash.util.lock.NotLockedException)6 HttpException (net.sourceforge.processdash.util.HttpException)5 AlreadyLockedException (net.sourceforge.processdash.util.lock.AlreadyLockedException)5 LockUncertainException (net.sourceforge.processdash.util.lock.LockUncertainException)5 URL (java.net.URL)3 ArrayList (java.util.ArrayList)3 File (java.io.File)2 List (java.util.List)2 ResourceCollectionDiff (net.sourceforge.processdash.tool.bridge.report.ResourceCollectionDiff)2 MalformedURLException (java.net.MalformedURLException)1 Enumeration (java.util.Enumeration)1 StringTokenizer (java.util.StringTokenizer)1 Vector (java.util.Vector)1 ZipFile (java.util.zip.ZipFile)1 DashHierarchy (net.sourceforge.processdash.hier.DashHierarchy)1