diff options
| author | Simon Rettberg | 2015-08-17 22:24:32 +0200 |
|---|---|---|
| committer | Simon Rettberg | 2015-08-17 22:24:32 +0200 |
| commit | a1e78471cc14b5ded5be4901e54faad6298a9a9f (patch) | |
| tree | 1cdd6c865b768f6582f99283e278b18e94a8e763 | |
| parent | [server] Only retry on transport error (diff) | |
| download | tutor-module-a1e78471cc14b5ded5be4901e54faad6298a9a9f.tar.gz tutor-module-a1e78471cc14b5ded5be4901e54faad6298a9a9f.tar.xz tutor-module-a1e78471cc14b5ded5be4901e54faad6298a9a9f.zip | |
[*] Adapt to changed ErrorCallback setters in master-sync-shared
| -rw-r--r-- | dozentenmodul/src/main/java/org/openslx/dozmod/gui/MainWindow.java | 30 | ||||
| -rw-r--r-- | dozentenmodulserver/src/main/java/org/openslx/bwlp/sat/App.java | 2 |
2 files changed, 27 insertions, 5 deletions
diff --git a/dozentenmodul/src/main/java/org/openslx/dozmod/gui/MainWindow.java b/dozentenmodul/src/main/java/org/openslx/dozmod/gui/MainWindow.java index bc3e4554..cacea2bb 100644 --- a/dozentenmodul/src/main/java/org/openslx/dozmod/gui/MainWindow.java +++ b/dozentenmodul/src/main/java/org/openslx/dozmod/gui/MainWindow.java @@ -64,7 +64,6 @@ public abstract class MainWindow { private static final List<ActivityPanel> activities = new ArrayList<>(); - private static final String THRIFT_CONNECTION_ERROR = "Lost connection to the masterserver. Do you want to retry?"; /** * Set the visible page of the main window. @@ -138,9 +137,10 @@ public abstract class MainWindow { }); // Set up thrift error message displaying - ThriftManager.setErrorCallback(new ErrorCallback() { + // TODO: Make this ECB a class with a parameter for the name to display, as this is the only thing that differs here + ThriftManager.setMasterErrorCallback(new ErrorCallback() { @Override - public boolean thriftError(int failCount, String method, final Throwable t) { + public boolean thriftError(int failCount, final String method, final Throwable t) { // if it's the first fail, retry immediately if (failCount == 1) return true; @@ -148,7 +148,29 @@ public abstract class MainWindow { return Gui.syncExec(new GuiCallable<Boolean>() { @Override public Boolean run() { - return Gui.showMessageBox(mainWindow, THRIFT_CONNECTION_ERROR, + return Gui.showMessageBox(mainWindow, "Die Kommunikation mit dem bwLehrpool-Zentralserver ist" + + " gestört. Der Aufruf der Funktion " + method + + " ist fehlgeschlagen.\n\n" + + "Möchten Sie den Aufruf wiederholen?", + MessageType.ERROR_RETRY, LOGGER, t); + } + }); + } + }); + ThriftManager.setMasterErrorCallback(new ErrorCallback() { + @Override + public boolean thriftError(int failCount, final String method, final Throwable t) { + // if it's the first fail, retry immediately + if (failCount == 1) + return true; + // Otherwise, ask user if we should retry + return Gui.syncExec(new GuiCallable<Boolean>() { + @Override + public Boolean run() { + return Gui.showMessageBox(mainWindow, "Die Kommunikation mit dem Satellitenserver ist" + + " gestört. Der Aufruf der Funktion " + method + + " ist fehlgeschlagen.\n\n" + + "Möchten Sie den Aufruf wiederholen?", MessageType.ERROR_RETRY, LOGGER, t); } }); diff --git a/dozentenmodulserver/src/main/java/org/openslx/bwlp/sat/App.java b/dozentenmodulserver/src/main/java/org/openslx/bwlp/sat/App.java index dee43127..261fbf5a 100644 --- a/dozentenmodulserver/src/main/java/org/openslx/bwlp/sat/App.java +++ b/dozentenmodulserver/src/main/java/org/openslx/bwlp/sat/App.java @@ -60,7 +60,7 @@ public class App { System.exit(1); } - ThriftManager.setErrorCallback(new ErrorCallback() { + ThriftManager.setMasterErrorCallback(new ErrorCallback() { @Override public boolean thriftError(int failCount, String method, Throwable t) { |
