finished refactoring client for additions to protocol

This commit is contained in:
Aidan Hahn 2019-05-23 16:10:43 -07:00
parent 11d8516417
commit 9eb18219cb
No known key found for this signature in database
GPG key ID: 327711E983899316
2 changed files with 19 additions and 5 deletions

View file

@ -94,8 +94,25 @@ public class JobServClient {
}
int newProcess = this.api.sendNewJobMessage(command);
// TODO: switch here for negative returns
System.out.printf("Process started, assigned pid is %d\n", newProcess);
switch(newProcess) {
case -1:
System.out.println(this.serversideTimeoutErrorMessage);
break;
case -2:
System.out.println("Server failed to create job, check server logs.");
break;
case -3:
// error logged by API Connector
break;
default:
System.out.printf("Process started, assigned pid is %d\n", newProcess);
break;
}
return;
}
/*

View file

@ -10,7 +10,6 @@ package JobServ;
import io.grpc.ManagedChannel;
import io.grpc.StatusRuntimeException;
import java.io.File;
import java.util.concurrent.TimeUnit;
import java.util.logging.Level;
import java.util.logging.Logger;
@ -23,8 +22,6 @@ import java.util.logging.Logger;
* and to allow for a veriety of interfaces to be created
*/
class JobServClientAPIConnector {
private final String serversideTimeoutErrorMessage = "Timeout locking process control on server\n"+
"Server could be under heavy load\nConsider trying again.";
private final String apiFailureMessage = "Failed while trying to connect to server.";
/*