Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
NomadCommandSystem
Manage
Activity
Members
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Container registry
Model registry
Analyze
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Instrument Control
NomadCommandSystem
Commits
99cc2c20
Commit
99cc2c20
authored
12 years ago
by
Jerome Locatelli
Browse files
Options
Downloads
Patches
Plain Diff
Pre-merge of branch Instrument_RC_168
parent
6116936c
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/fr/ill/ics/nscclient/serverconnection/ServerConnectedAndReady.java
+27
-12
27 additions, 12 deletions
...s/nscclient/serverconnection/ServerConnectedAndReady.java
with
27 additions
and
12 deletions
src/fr/ill/ics/nscclient/serverconnection/ServerConnectedAndReady.java
+
27
−
12
View file @
99cc2c20
...
...
@@ -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
)
{
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment