@Override public void start(final StartContext context) throws StartException { final BatchEnvironment batchEnvironment = this.batchEnvironment = batchEnvironmentInjector.getValue(); // Get the class loader from the environment classLoader = batchEnvironment.getClassLoader(); suspendControllerInjector.getValue().registerActivity(serverActivity); }
/** * Stops the service. Unregisters service activity and clears transaction listener. * @param context stop context */ public void stop(StopContext context) { final SuspendController suspendController = suspendControllerInjectedValue.getValue(); suspendController.unRegisterActivity(this); final LocalTransactionContext localTransactionContext = localTransactionContextInjectedValue.getValue(); localTransactionContext.removeCreationListener(this); }
@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); }
suspendController.addListener(operationListener); suspendController.suspend(timeout > 0 ? timeout * 1000 : timeout); if(timeout != 0 && suspendController.getState() != SuspendController.State.SUSPENDED) { try { latch.await();
SuspendController controller = suspendControllerSupplier != null ? suspendControllerSupplier.get() : null; 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 timeout() { suspendController.removeListener(this); suspendLatch.countDown(); } };
@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(listener); suspendController.suspend(timeout); if (timeout > 0) {
@Override public void start(StartContext context) throws StartException { suspendControllerInjectedValue.getValue().addListener(listener); }
suspendController.addListener(operationListener); suspendController.suspend(timeout > 0 ? timeout * 1000 : timeout); if(timeout != 0 && suspendController.getState() != SuspendController.State.SUSPENDED) { try { latch.await();
@Override public void complete() { suspendController.removeListener(this); suspendLatch.countDown(); }
@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(listener); suspendController.suspend(timeout); if (timeout > 0) {
@Override public void start(StartContext context) throws StartException { suspendControllerInjectedValue.getValue().addListener(listener); }
/** * Starts the service. Registers server activity, sets transaction listener on local transaction context, and creates and * installs deployment controller service. * * @param context start context */ public void start(StartContext context) { final SuspendController suspendController = suspendControllerInjectedValue.getValue(); suspendController.registerActivity(this); final LocalTransactionContext localTransactionContext = localTransactionContextInjectedValue.getValue(); localTransactionContext.registerCreationListener(this); }
public synchronized void stop(StopContext context) { suspendControllerInjector.getValue().unRegisterActivity(recoverySuspendController); try { recoveryManagerService.stop(); } catch (Exception e) { // todo log } recoveryManagerService.destroy(); recoveryManagerService = null; recoverySuspendController = null; }
@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 cancelled() { suspendController.removeListener(this); suspendLatch.countDown(); }
registerStateListener(mbean, processStateService); if (suspendController != null) { suspendController.addListener(new OperationListener() { @Override public void suspendStarted() {
@Override public void init() { if (endpoint == null) { throw EjbLogger.ROOT_LOGGER.endpointUnAvailable(this.getComponentName()); } super.init(); suspendController.registerActivity(serverActivity); if (this.pool != null) { this.pool.start(); } }