@Override public boolean execute(ManagedServer server) throws Exception { assert Thread.holdsLock(ManagedServer.this); // Call under lock // Stop process try { // graceful shutdown // this just suspends the server, it does not actually shut it down if (permit != -1) { final ModelNode operation = new ModelNode(); operation.get(OP).set("shutdown"); operation.get(OP_ADDR).setEmptyList(); operation.get("operation-id").set(permit); operation.get("timeout").set(timeout); final TransactionalProtocolClient.PreparedOperation<?> prepared = TransactionalProtocolHandlers.executeBlocking(operation, protocolClient); if (prepared.isFailed()) { return true; } // we stop the server via an operation prepared.commit(); prepared.getFinalResult().get(); } } catch (Exception ignore) { } finally { try { processControllerClient.stopProcess(serverProcessName); } catch (IOException ignore) { } } return true; }
boolean resume() { final ModelNode operation = new ModelNode(); operation.get(OP).set("resume"); operation.get(OP_ADDR).setEmptyList(); try { final TransactionalProtocolClient.PreparedOperation<?> prepared = TransactionalProtocolHandlers.executeBlocking(operation, protocolClient); if (prepared.isFailed()) { return false; } prepared.commit(); prepared.getFinalResult().get(); } catch (Exception ignore) { return false; } return true; }
@Override public boolean execute(ManagedServer server) throws Exception { final ModelNode operation = new ModelNode(); operation.get(OP).set("reload"); operation.get(OP_ADDR).setEmptyList(); operation.get("operation-id").set(permit); try { final TransactionalProtocolClient.PreparedOperation<?> prepared = TransactionalProtocolHandlers.executeBlocking(operation, protocolClient); if (prepared.isFailed()) { return false; } prepared.commit(); // Just commit and discard the result } catch (IOException ignore) { // } return true; }
void awaitSuspended(long timeout) { // we just re-suspend, but this time give a timeout final ModelNode operation = new ModelNode(); operation.get(OP).set("suspend"); operation.get(OP_ADDR).setEmptyList(); operation.get(TIMEOUT).set(timeout); try { final TransactionalProtocolClient.PreparedOperation<?> prepared = TransactionalProtocolHandlers.executeBlocking(operation, protocolClient); if (prepared.isFailed()) { return; } prepared.commit(); prepared.getFinalResult().get(); } catch (Exception ignore) { return; } return; }