Handle when server doesn't send the expected response

This commit is contained in:
Laurent Clouet
2016-09-11 13:46:12 +02:00
parent 0d660b023b
commit 018382ac6f
4 changed files with 39 additions and 0 deletions

View File

@@ -33,6 +33,7 @@ import java.util.concurrent.BlockingQueue;
import com.sheepit.client.Error.ServerCode;
import com.sheepit.client.Error.Type;
import com.sheepit.client.exception.FermeException;
import com.sheepit.client.exception.FermeExceptionBadResponseFromServer;
import com.sheepit.client.exception.FermeExceptionNoRightToRender;
import com.sheepit.client.exception.FermeExceptionNoSession;
import com.sheepit.client.exception.FermeExceptionNoSpaceLeftOnDevice;
@@ -247,6 +248,18 @@ public class Client {
}
continue; // go back to ask job
}
catch (FermeExceptionBadResponseFromServer e) {
int wait = 15;
int time_sleep = 1000 * 60 * wait;
this.gui.status(String.format("Bad answer from server. Will retry in %s minutes", wait));
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();