wildfly / wildfly-plugin-tools

A group of tools for interacting/managing with a WildFly container
Apache License 2.0
0 stars 2 forks source link

The return type for shutdown invocations should return a CompletableFuture which returns the ServerManager on get() #52

Closed jamezp closed 3 months ago

jamezp commented 3 months ago

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");
}
jamezp commented 3 months ago

It may be better to change kill(), but have a shutdownAsync() option instead of changing the API.