/** * Calls {@link #logBeforeExit(ExitLogger)} and then invokes the {@link Exiter}. * @param logger logger the logger. Cannot be {@code null} * @param status the status code to provide to the exiter */ public static void logAndExit(ExitLogger logger, int status) { logBeforeExit(logger); getExiter().exit(status); // If we get here, the exiter didn't really exit. So we // must be embedded or something, or perhaps in a test case // Reset the logged flag so we can log again the next time // someone "exits" logged.set(false); }
/** * Calls {@link #logBeforeExit(ExitLogger)} and then invokes the {@link Exiter}. * @param logger logger the logger. Cannot be {@code null} * @param status the status code to provide to the exiter */ public static void logAndExit(ExitLogger logger, int status) { logBeforeExit(logger); getExiter().exit(status); // If we get here, the exiter didn't really exit. So we // must be embedded or something, or perhaps in a test case // Reset the logged flag so we can log again the next time // someone "exits" logged.set(false); }
@Override public void execute(OperationContext context, ModelNode operation) throws OperationFailedException { // WFLY-2741 -- DO NOT call context.getServiceRegistry(true) as that will trigger blocking for // service container stability and one use case for this op is to recover from a // messed up service container from a previous op. Instead just ask for authorization. // Note that we already have the exclusive lock, so we are just skipping waiting for stability. // If another op that is a step in a composite step with this op needs to modify the container // it will have to wait for container stability, so skipping this only matters for the case // where this step is the only runtime change. // context.getServiceRegistry(true); AuthorizationResult authorizationResult = context.authorize(operation, EnumSet.of(Action.ActionEffect.WRITE_RUNTIME)); if (authorizationResult.getDecision() == AuthorizationResult.Decision.DENY) { throw ControllerLogger.ACCESS_LOGGER.unauthorized(operation.get(OP).asString(), PathAddress.pathAddress(operation.get(OP_ADDR)), authorizationResult.getExplanation()); } SystemExiter.logBeforeExit(new SystemExiter.ExitLogger() { @Override public void logExit() { HostControllerLogger.ROOT_LOGGER.shuttingDownInResponseToManagementRequest(getOperationName(operation)); } }); if (restart) { //Add the exit code so that we get respawned domainController.stopLocalHost(ExitCodes.RESTART_PROCESS_FROM_STARTUP_SCRIPT); } else { domainController.stopLocalHost(); } context.completeStep(OperationContext.RollbackHandler.NOOP_ROLLBACK_HANDLER); } }, OperationContext.Stage.RUNTIME);
@Override public void execute(OperationContext context, ModelNode operation) throws OperationFailedException { // WFLY-2741 -- DO NOT call context.getServiceRegistry(true) as that will trigger blocking for // service container stability and one use case for this op is to recover from a // messed up service container from a previous op. Instead just ask for authorization. // Note that we already have the exclusive lock, so we are just skipping waiting for stability. // If another op that is a step in a composite step with this op needs to modify the container // it will have to wait for container stability, so skipping this only matters for the case // where this step is the only runtime change. // context.getServiceRegistry(true); AuthorizationResult authorizationResult = context.authorize(operation, EnumSet.of(Action.ActionEffect.WRITE_RUNTIME)); if (authorizationResult.getDecision() == AuthorizationResult.Decision.DENY) { throw ControllerLogger.ACCESS_LOGGER.unauthorized(operation.get(OP).asString(), PathAddress.pathAddress(operation.get(OP_ADDR)), authorizationResult.getExplanation()); } SystemExiter.logBeforeExit(new SystemExiter.ExitLogger() { @Override public void logExit() { HostControllerLogger.ROOT_LOGGER.shuttingDownInResponseToManagementRequest(getOperationName(operation)); } }); if (restart) { //Add the exit code so that we get respawned domainController.stopLocalHost(ExitCodes.RESTART_PROCESS_FROM_STARTUP_SCRIPT); } else { domainController.stopLocalHost(); } context.completeStep(OperationContext.RollbackHandler.NOOP_ROLLBACK_HANDLER); } }, OperationContext.Stage.RUNTIME);
SystemExiter.logBeforeExit(ServerLogger.ROOT_LOGGER::shutdownHookInvoked);
SystemExiter.logBeforeExit(ServerLogger.ROOT_LOGGER::shutdownHookInvoked);