Let's say that I have a long task in R. If the connection breaks and times-out is there a way to reconnect?
What I want to do is a dialog that waits for a new connection. For instance:
RConnection r = ConnectionFactoryR.getConnection(ServerRHost, ServerRPort, ServerRUser, ServerRPass);
try {
r.parseAndEval("A<-0");
} catch (REngineException | REXPMismatchException e2) {
}
while(true){
try {
int a = r.parseAndEval("A<-A+1").asInteger();
System.out.println(a);
if(a>30000)
break;
} catch (Exception e1) { //Should be a specific exception.
ConnectionRFailureDialog dialog = new ConnectionRFailureDialog(e1,ServerRHost,ServerRPort,ServerRUser,ServerRPass);
r = dialog.returning(); // Applied this way keeps on executing the function although the error may not be from the REngine or Missmatch...usually is a SocketTimeOutException thrown deep on a Native method.
try {
r.parseAndEval("A<-0;");
} catch (REngineException | REXPMismatchException e) {
};
}
Let's say that I have a long task in R. If the connection breaks and times-out is there a way to reconnect? What I want to do is a dialog that waits for a new connection. For instance:
RConnection r = ConnectionFactoryR.getConnection(ServerRHost, ServerRPort, ServerRUser, ServerRPass); try { r.parseAndEval("A<-0"); } catch (REngineException | REXPMismatchException e2) { }
while(true){ try { int a = r.parseAndEval("A<-A+1").asInteger(); System.out.println(a); if(a>30000) break; } catch (Exception e1) { //Should be a specific exception. ConnectionRFailureDialog dialog = new ConnectionRFailureDialog(e1,ServerRHost,ServerRPort,ServerRUser,ServerRPass); r = dialog.returning(); // Applied this way keeps on executing the function although the error may not be from the REngine or Missmatch...usually is a SocketTimeOutException thrown deep on a Native method. try { r.parseAndEval("A<-0;"); } catch (REngineException | REXPMismatchException e) {
}; }