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

@@ -78,6 +78,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 Server extends Thread implements HostnameVerifier, X509TrustManager {
@@ -145,6 +146,9 @@ public class Server extends Thread implements HostnameVerifier, X509TrustManager
}
}
}
catch (NoRouteToHostException e) {
this.log.debug("Server::keeepmealive can not connect to server");
}
catch (IOException e) {
e.printStackTrace();
}
@@ -434,6 +438,9 @@ public class Server extends Thread implements HostnameVerifier, X509TrustManager
catch (FermeException e) {
throw e;
}
catch (NoRouteToHostException e) {
throw new FermeServerDown();
}
catch (Exception e) {
StringWriter sw = new StringWriter();
PrintWriter pw = new PrintWriter(sw);