Some helper methods should be added to the ServerHelper for starting a server. These would accept a org.wildfly.core.launcher.CommandBuilder and use the org.wildfly.core.launcher.Launcher to start the server.
The result could be returned in a CompletableFuture<ServerManager>, but that is awkward to handle waiting for the server to start. It's likely better to start the server and wait for it to start before returning the result. A user could make it functional with something like:
final CompletableFuture<ServerManager> serverManager = CompletableFuture.supplyAsync(() -> ServerManager.start(commandBuilder)));
However, while developing the API, if there ends up being a good way to return the CompletableFuture or a CompletionStage it should be done.
One option is to have a waitFor() method on the ServerManager which waits indefinitely. Then a timeout could be used on the CompletableFuture.
Thinking more about this. There will be an issue with a non-functional approach tying to make it functional. It could leave the process running in the background even if a timeout occurs.
Some helper methods should be added to the
ServerHelper
for starting a server. These would accept aorg.wildfly.core.launcher.CommandBuilder
and use theorg.wildfly.core.launcher.Launcher
to start the server.The result could be returned in a
CompletableFuture<ServerManager>
, but that is awkward to handle waiting for the server to start. It's likely better to start the server and wait for it to start before returning the result. A user could make it functional with something like:However, while developing the API, if there ends up being a good way to return the
CompletableFuture
or aCompletionStage
it should be done.One option is to have a
waitFor()
method on theServerManager
which waits indefinitely. Then a timeout could be used on theCompletableFuture
.