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);
}
}
Aggregations