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

Add some helper methods to the `ServerManager` for starting a server #47

Closed jamezp closed 2 months ago

jamezp commented 2 months ago

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.

jamezp commented 2 months ago

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.