I reload the WildFly server as follows
CliCommandBuilder cliCommandBuilder = ...
cliCommandBuilder
.setCommand(
"reload"
);
Launcher.of(cliCommandBuilder)
.inherit()
.setRedirectErrorStream(true)
.launch();
And I need to wait for the server to start, because then I will deploy the new content. How can I do this?
I tried use method .waitFor() from java.lang.Process
Launcher.of(cliCommandBuilder)
.inherit()
.setRedirectErrorStream(true)
.launch().waitFor();
But the thread continues to work after shutting down WildFly, not starting
I thought the
reloadcommand waited to terminate the process until WildFly was reloaded. However, there is a helper API you could use to check the process. Something like this should work: