Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Timeouts #15

Open
AndreGuerra123 opened this issue May 6, 2017 · 0 comments
Open

Timeouts #15

AndreGuerra123 opened this issue May 6, 2017 · 0 comments

Comments

@AndreGuerra123
Copy link

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) {
};
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant