The shutdown(), shutdown(long, TimeUnit) and kill() methods should return a CompletableFuture<ServerManager> which allows waiting for the process to be terminated before returning. This would allow for something like:
// Wait to restart until the process has needed
serverManager.shutdown().get();
serverManager = ServerManager.start(commandBuilder);
if (!serverManager.waitFor(60L, TimeUnit.SECONDS)) {
serverManager.kill().get();
throw new RuntimeException("The server failed to start within 60 seconds");
}
The
shutdown()
,shutdown(long, TimeUnit)
andkill()
methods should return aCompletableFuture<ServerManager>
which allows waiting for the process to be terminated before returning. This would allow for something like: