public static Values allowResourceServiceRestart() { return Values.of(Constants.ALLOW_RESOURCE_SERVICE_RESTART, true); } }
@Override public ModelNodeResult perform(Operations ops, Address address) throws IOException { return ops.invoke(Constants.RELOAD, address, Values.of(Constants.DOMAIN_CONFIG, snapshot)); } }
@Override public ModelNodeResult perform(Operations ops, Address address) throws IOException { return ops.invoke(Constants.RELOAD, address, Values.of(Constants.SERVER_CONFIG, snapshot)); } }
@Override public ModelNodeResult perform(Operations ops, Address address) throws IOException { // only works for standalone servers return ops.invoke(Constants.RELOAD, address, Values.of(Constants.USE_CURRENT_SERVER_CONFIG, false)); } }
@Override public ModelNodeResult perform(Operations ops, Address address) throws IOException { return ops.invoke(Constants.SHUTDOWN, address, Values.of(Constants.RESTART, true)); } };
@Override public void shutdown(int timeoutInSeconds) throws IOException { if (timeoutInSeconds == 0) { // older versions don't understand the "timeout" parameter ops.invoke(Constants.SHUTDOWN, Address.root()); } else { ops.invoke(Constants.SHUTDOWN, Address.root(), Values.of(Constants.TIMEOUT, timeoutInSeconds)); } }
/** * Stops given {@code server} on given {@code host}. * * @return {@code true} when server was successfully stopped, {@code false} otherwise */ public boolean stopServer(String host, String server) throws IOException { ModelNodeResult result = ops.invoke("stop", Address.host(host).and(Constants.SERVER_CONFIG, server), Values.of("blocking", true)); result.assertDefinedValue(); return result.isSuccess(); }
/** * Starts given {@code server} on given {@code host}. * * @return {@code true} when server was successfully started, {@code false} otherwise */ public boolean startServer(String host, String server) throws IOException { ModelNodeResult result = ops.invoke(Constants.START, Address.host(host).and(Constants.SERVER_CONFIG, server), Values.of(Constants.BLOCKING, true)); result.assertDefinedValue(); return result.isSuccess(); }
void shutdownServersGracefully(String host, List<String> servers, int timeoutInSeconds) throws IOException, InterruptedException, TimeoutException { client.version().assertAtLeast(ServerVersion.VERSION_3_0_0, "Graceful shutdown is only supported since WildFly 9"); Batch batch = new Batch(); for (String server : servers) { batch.invoke(Constants.STOP, Address.host(host).and(Constants.SERVER_CONFIG, server), Values.of(Constants.TIMEOUT, timeoutInSeconds)); } ops.batch(batch); }
void shutdown(String host, int timeoutInSeconds) throws IOException { if (timeoutInSeconds == 0) { // older versions don't understand the "timeout" parameter ops.invoke(Constants.SHUTDOWN, Address.host(host)); } else { Batch batch = new Batch(); for (String server : allRunningServers(host)) { batch.invoke(Constants.STOP, Address.host(host).and(Constants.SERVER_CONFIG, server), Values.of(Constants.TIMEOUT, timeoutInSeconds)); } batch.invoke(Constants.SHUTDOWN, Address.host(host)); ops.batch(batch); } }