Better handle when server is down

This commit is contained in:
Laurent Clouet
2015-07-08 19:44:38 +01:00
parent f584b67e0f
commit b088fb920d
3 changed files with 54 additions and 0 deletions

View File

@@ -36,6 +36,7 @@ import com.sheepit.client.exception.FermeException;
import com.sheepit.client.exception.FermeExceptionNoRightToRender;
import com.sheepit.client.exception.FermeExceptionNoSession;
import com.sheepit.client.exception.FermeExceptionSessionDisabled;
import com.sheepit.client.exception.FermeServerDown;
import com.sheepit.client.os.OS;
public class Client {
@@ -205,6 +206,18 @@ public class Client {
}
}
}
catch (FermeServerDown e) {
int wait = 15;
int time_sleep = 1000 * 60 * wait;
this.gui.status(String.format("Can not connect to server. Please check your connectivity. Will retry in %s minutes", 15));
try {
Thread.sleep(time_sleep);
}
catch (InterruptedException e1) {
return -3;
}
continue; // go back to ask job
}
catch (FermeException e) {
this.gui.error("Client::renderingManagement exception requestJob (1) " + e.getMessage());
StringWriter sw = new StringWriter();