Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
Instrument Control
NomadCommandSystem
Commits
456a198c
Commit
456a198c
authored
Mar 08, 2016
by
yannick legoc
Browse files
first use of cameo in NomadServer
parent
993f50aa
Changes
2
Hide whitespace changes
Inline
Side-by-side
pom.xml
View file @
456a198c
...
...
@@ -6,7 +6,7 @@
<name>
NomadCommandSystem
</name>
<description>
Java bridge for the communication with the Nomad server
</description>
<scm>
<connection>
scm:svn:http://forge.ill.fr/svn/nomad
</connection>
<connection>
scm:svn:http://forge.ill.fr/svn/nomad
/ill/NomadCommandSystem/trunk
</connection>
</scm>
<distributionManagement>
...
...
@@ -62,6 +62,11 @@
<artifactId>
protobuf-java
</artifactId>
<version>
2.6.1
</version>
</dependency>
<dependency>
<groupId>
fr.ill.ics
</groupId>
<artifactId>
cameo-api-java
</artifactId>
<version>
0.0.1
</version>
</dependency>
</dependencies>
<build>
<plugins>
...
...
src/main/java/fr/ill/ics/nscclient/serverconnection/ServerDisconnected.java
View file @
456a198c
...
...
@@ -25,6 +25,9 @@ import java.io.InputStreamReader;
import
java.util.HashMap
;
import
java.util.Map
;
import
fr.ill.ics.cameo.Application
;
import
fr.ill.ics.cameo.ConnectionTimeout
;
import
fr.ill.ics.cameo.Server
;
import
fr.ill.ics.util.ConfigManager
;
/**
...
...
@@ -85,33 +88,24 @@ public class ServerDisconnected extends ServerConnectionState {
}
}
// Launch script
System
.
out
.
println
(
"starting nomad server with nappli"
);
// connect to the server
Server
server
=
new
Server
(
"tcp://localhost:7000"
);
// start nomad server
try
{
String
execCommand
=
getExecCommand
();
System
.
out
.
println
(
"starting "
+
execCommand
);
// adding -remote option to avoid having console
if
(
serverId
.
equals
(
"real"
)
&&
ConfigManager
.
getInstance
().
getBoolean
(
"serverTestMode"
))
{
// execution in xterm
Runtime
.
getRuntime
().
exec
(
"xterm -bg white -fg black -e "
+
execCommand
);
}
else
{
// hidden execution
Process
process
=
Runtime
.
getRuntime
().
exec
(
execCommand
);
// reading process output stream (flush the buffer to avoid to block the process when the buffer is full)
StreamThread
readOutThread
=
new
StreamThread
(
process
.
getInputStream
());
readOutThread
.
start
();
// reading process error stream (flush the buffer to avoid to block the process when the buffer is full)
StreamThread
readErrThread
=
new
StreamThread
(
process
.
getErrorStream
());
readErrThread
.
start
();
Application
.
Instance
nomad
=
server
.
start
(
"ns"
);
if
(
nomad
.
exists
())
{
System
.
out
.
println
(
"started "
+
nomad
);
}
launchTime
=
System
.
currentTimeMillis
();
}
catch
(
IOException
e
)
{
e
.
printStackTrace
();
}
catch
(
ConnectionTimeout
e
)
{
System
.
err
.
println
(
"timeout while starting nomad server"
);
}
server
.
terminate
();
Integer
value
=
nRestarts
.
get
(
serverId
);
value
++;
nRestarts
.
put
(
serverId
,
value
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment