Search in sources :

Example 1 with OfflineLockLostException

use of net.sourceforge.processdash.util.lock.OfflineLockLostException in project processdash by dtuma.

the class ProcessDashboard method tryToLockDataForWriting.

private void tryToLockDataForWriting() {
    String lockOwnerName = getOwnerName();
    String otherUser = null;
    try {
        workingDirectory.acquireWriteLock(lockMessageHandler, lockOwnerName);
        return;
    } catch (ReadOnlyLockFailureException ro) {
        showFilesAreReadOnlyMessage(workingDirectory.getDescription(), ro);
        return;
    } catch (CannotCreateLockException e) {
        showCannotCreateLockMessage(workingDirectory.getDescription(), e);
        return;
    } catch (OfflineLockLostException e) {
        showLostOfflineLockMessage(workingDirectory.getDescription(), e);
        return;
    } catch (AlreadyLockedException e) {
        otherUser = e.getExtraInfo();
    } catch (LockFailureException e) {
        showCannotCreateLockMessage(workingDirectory.getDescription(), e);
        return;
    }
    ResourceBundle r = ResourceBundle.getBundle("Templates.resources.ProcessDashboard");
    if (!StringUtils.hasValue(otherUser))
        otherUser = r.getString("Errors.Concurrent_Use_Someone_Else");
    String title = r.getString("Errors.Concurrent_Use_Title");
    String message = MessageFormat.format(r.getString("Errors.Concurrent_Use_Message2_FMT"), otherUser);
    if (JOptionPane.showConfirmDialog(hideSS(), message.split("\n"), title, JOptionPane.YES_NO_OPTION) == JOptionPane.YES_OPTION) {
        InternalSettings.setReadOnly(true);
    } else {
        System.exit(0);
    }
}
Also used : OfflineLockLostException(net.sourceforge.processdash.util.lock.OfflineLockLostException) AlreadyLockedException(net.sourceforge.processdash.util.lock.AlreadyLockedException) ReadOnlyLockFailureException(net.sourceforge.processdash.util.lock.ReadOnlyLockFailureException) CannotCreateLockException(net.sourceforge.processdash.util.lock.CannotCreateLockException) ResourceBundle(java.util.ResourceBundle) LockFailureException(net.sourceforge.processdash.util.lock.LockFailureException) ReadOnlyLockFailureException(net.sourceforge.processdash.util.lock.ReadOnlyLockFailureException)

Aggregations

ResourceBundle (java.util.ResourceBundle)1 AlreadyLockedException (net.sourceforge.processdash.util.lock.AlreadyLockedException)1 CannotCreateLockException (net.sourceforge.processdash.util.lock.CannotCreateLockException)1 LockFailureException (net.sourceforge.processdash.util.lock.LockFailureException)1 OfflineLockLostException (net.sourceforge.processdash.util.lock.OfflineLockLostException)1 ReadOnlyLockFailureException (net.sourceforge.processdash.util.lock.ReadOnlyLockFailureException)1