@Override public void start(StartContext context) throws StartException { suspendControllerInjectedValue.getValue().registerActivity(suspendListener); if(suspendControllerInjectedValue.getValue().getState() == SuspendController.State.RUNNING) { defaultHandler.setSuspended(false); } else { defaultHandler.setSuspended(true); } ControlledProcessStateService controlledProcessStateService = controlledProcessStateServiceInjectedValue.getValue(); //may be null for tests if(controlledProcessStateService != null && controlledProcessStateService.getCurrentState() == ControlledProcessState.State.STARTING) { gateHandlerWrapper = new GateHandlerWrapper(queueRequestsOnStart ? -1 : defaultResponseCode); controlledProcessStateService.addPropertyChangeListener(new PropertyChangeListener() { @Override public void propertyChange(PropertyChangeEvent evt) { controlledProcessStateService.removePropertyChangeListener(this); if(gateHandlerWrapper != null) { gateHandlerWrapper.open(); gateHandlerWrapper = null; } rootHandler = null; } }); } server.getValue().registerHost(this); UndertowLogger.ROOT_LOGGER.hostStarting(name); }
@Override public void execute(OperationContext context, ModelNode operation) throws OperationFailedException { @SuppressWarnings("unchecked") ServiceController<SuspendController> sc = (ServiceController<SuspendController>) context.getServiceRegistry(false).getService(JBOSS_SUSPEND_CONTROLLER); SuspendController.State state; if(sc != null) { state = sc.getValue().getState(); } else { // Either we haven't installed the SC yet or we're stopping and it's been removed // If we haven't installed, when we do its initial state is SUSPENDED // If it's been removed, it's last state was SUSPENDED. // So, report that. state = SuspendController.State.SUSPENDED; } context.getResult().set(state.name()); }
@Override public void execute(OperationContext context, ModelNode operation) throws OperationFailedException { @SuppressWarnings("unchecked") ServiceController<SuspendController> sc = (ServiceController<SuspendController>) context.getServiceRegistry(false).getService(JBOSS_SUSPEND_CONTROLLER); SuspendController.State state; if(sc != null) { state = sc.getValue().getState(); } else { // Either we haven't installed the SC yet or we're stopping and it's been removed // If we haven't installed, when we do its initial state is SUSPENDED // If it's been removed, it's last state was SUSPENDED. // So, report that. state = SuspendController.State.SUSPENDED; } context.getResult().set(state.name()); }
suspendController.addListener(operationListener); suspendController.suspend(timeout > 0 ? timeout * 1000 : timeout); if(timeout != 0 && suspendController.getState() != SuspendController.State.SUSPENDED) { try { latch.await();
suspendController.addListener(operationListener); suspendController.suspend(timeout > 0 ? timeout * 1000 : timeout); if(timeout != 0 && suspendController.getState() != SuspendController.State.SUSPENDED) { try { latch.await();
if (controller != null) { controller.addListener(operationListener); CoreManagementLogger.ROOT_LOGGER.debugf("Starting ProcessStateListenerService with a SuspendControllerState %s", controller.getState()); switch (controller.getState()) { case PRE_SUSPEND: this.runningState = Process.RunningState.PRE_SUSPEND;
@Override public void start(StartContext context) throws StartException { suspendControllerInjectedValue.getValue().registerActivity(suspendListener); if(suspendControllerInjectedValue.getValue().getState() == SuspendController.State.RUNNING) { defaultHandler.setSuspended(false); } else { defaultHandler.setSuspended(true); } ControlledProcessStateService controlledProcessStateService = controlledProcessStateServiceInjectedValue.getValue(); //may be null for tests if(controlledProcessStateService != null && controlledProcessStateService.getCurrentState() == ControlledProcessState.State.STARTING) { gateHandlerWrapper = new GateHandlerWrapper(queueRequestsOnStart ? -1 : defaultResponseCode); controlledProcessStateService.addPropertyChangeListener(new PropertyChangeListener() { @Override public void propertyChange(PropertyChangeEvent evt) { controlledProcessStateService.removePropertyChangeListener(this); if(gateHandlerWrapper != null) { gateHandlerWrapper.open(); gateHandlerWrapper = null; } rootHandler = null; } }); } server.getValue().registerHost(this); UndertowLogger.ROOT_LOGGER.hostStarting(name); }
@Override public void start(StartContext context) throws StartException { suspendControllerInjectedValue.getValue().registerActivity(suspendListener); if(suspendControllerInjectedValue.getValue().getState() == SuspendController.State.RUNNING) { defaultHandler.setSuspended(false); } else { defaultHandler.setSuspended(true); } ControlledProcessStateService controlledProcessStateService = controlledProcessStateServiceInjectedValue.getValue(); //may be null for tests if(controlledProcessStateService != null && controlledProcessStateService.getCurrentState() == ControlledProcessState.State.STARTING) { gateHandlerWrapper = new GateHandlerWrapper(queueRequestsOnStart ? -1 : defaultResponseCode); controlledProcessStateService.addPropertyChangeListener(new PropertyChangeListener() { @Override public void propertyChange(PropertyChangeEvent evt) { controlledProcessStateService.removePropertyChangeListener(this); if(gateHandlerWrapper != null) { gateHandlerWrapper.open(); gateHandlerWrapper = null; } rootHandler = null; } }); } server.getValue().registerHost(this); UndertowLogger.ROOT_LOGGER.hostStarting(name); }