cedric
04/27/2016, 4:08 PMvar connected = false
while (attempts < 5 && !connected) {
try {
port = ServerUtil.findServerPort()
if (port != null) {
socket = Socket("localhost", port)
connected = true
}
} catch(ex: Exception) {
LOG.warn("Server is not running: " + ex.message)
}
if (! connected) {
LOG.warn("Launching a new server")
ServerUtil.launchServer()
Thread.sleep(500)
attempts++
LOG.warn("New server launched, trying again")
}
}