Skip to content
Snippets Groups Projects
Commit 99cc2c20 authored by Jerome Locatelli's avatar Jerome Locatelli
Browse files

Pre-merge of branch Instrument_RC_168

parent 6116936c
No related branches found
No related tags found
No related merge requests found
......@@ -52,34 +52,45 @@ public class ServerConnectedAndReady extends ServerConnectionState {
//}
}
/**
* Tests the connection with the server to ensure that it is still ok. If
* we receive a corba exception (communication problems) then we try to
* re-establish a connection by creating the ServerConnectingState.
*/
public boolean makeConnection(ServerConnection connection) {
//System.out.println("ServerConnectedAndReady " + serverId + " make connection");
private void retrieveReadyIndicator() {
try {
String contextName = NOMAD_SERVER_CONTEXT_NAME;
if (!serverId.equals("real")) {
contextName += serverId;
}
// test connection
org.omg.CORBA.Object readyIndicatorObject = CorbaNamingService.getInstance().resolveObject(contextName, CORE_CONTEXT_NAME, READY_INDICATOR_OBJECT_NAME);
readyIndicator = ReadyIndicatorHelper.narrow(readyIndicatorObject);
State newState = readyIndicator.getState();
if (newState == State.STARTED) {
return true;
}
} catch (CORBAResolveFailureException e) {
// unaccessible object
} catch (org.omg.CORBA.SystemException e) {
// unaccessible object
}
}
/**
* Tests the connection with the server to ensure that it is still ok. If
* we receive a corba exception (communication problems) then we try to
* re-establish a connection by creating the ServerConnectingState.
*/
public boolean makeConnection(ServerConnection connection) {
//System.out.println("ServerConnectedAndReady " + serverId + " make connection");
retrieveReadyIndicator();
if (readyIndicator != null) {
State newState = readyIndicator.getState();
if (newState == State.STARTED) {
return true;
}
}
// Change state to try to establish another connection
connection.setState(new ServerConnecting(serverId));
return false;
......@@ -94,6 +105,10 @@ public class ServerConnectedAndReady extends ServerConnectionState {
public boolean checkConnection(ServerConnection connection) {
if (readyIndicator == null) {
retrieveReadyIndicator();
}
try {
State newState = readyIndicator.getState();
if (newState == State.STARTED) {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment