"Have you used a schema like \"rmi://localhost:"
+ MasterServer.DEFAULT_PORT + "/"
+ MasterServer.DEFAULT_BINDING_NAME + "\" ???", e);
emergency = true;
// addEvent("Exception occured while trying to connect to the server. Client is shutting down. Check the server adress.");
throw new ComputationSetupException(
"Exception occured while connecting to the server. Shutting down.", e);
}
// make myself known to the server
SimSystem.report(Level.INFO, "Simulation client " + getName()
+ " tries to register at the server!");
boolean registered = false;
int tries = 0;
while (!registered && (tries < 3)) {
try {
tries++;
server.register(this);
registered = true;
} catch (RemoteException e) {
if (tries < 3) {
SimSystem.report(Level.WARNING,
"Attempting to connect to server failed (Try: " + tries + ")");
try {
// wait at least a second, and at most 3 seconds - thereby
// distributing wait times (to avoid further conflicts by two many
// concurrent accesses)
this.wait(1000 + Math.round(Math.random() * 2000));
} catch (InterruptedException e1) {
}
} else {
SimSystem.report(Level.SEVERE, "Failed on connecting to server!");
SimSystem.report(e);
emergency = true;
// addEvent("unspecified exception occured attempting to register at the server");
throw new ComputationSetupException(
"Exception occured while registering at the server. Shutting down.",
e);
}
}