/** * Returns true if controller is in rest state and no async tasks are running, false otherwise. * @return true if stable rest state, false otherwise */ private boolean isStableRestState() { assert holdsLock(this); return asyncTasks == 0 && state.isRestState(); }
/** * Returns true if controller is in rest state and no async tasks are running, false otherwise. * @return true if stable rest state, false otherwise */ private boolean isStableRestState() { assert holdsLock(this); return asyncTasks == 0 && state.isRestState(); }
public synchronized void listenerAdded(final ServiceController<?> controller) { set.add(controller); if (!controller.getSubstate().isRestState()) { outstanding++; } }
final ServiceController.Substate after = transition.getAfter(); if (before.isRestState() && ! after.isRestState()) { untick(); } else if (! before.isRestState() && after.isRestState()) { tick();
private void updateStabilityState(final boolean leavingStableRestState) { assert holdsLock(this); final boolean enteringStableRestState = state.isRestState() && asyncTasks == 0; if (leavingStableRestState) { if (!enteringStableRestState) { container.incrementUnstableServices(); for (StabilityMonitor monitor : monitors) { monitor.incrementUnstableServices(); } } } else { if (enteringStableRestState) { container.decrementUnstableServices(); for (StabilityMonitor monitor : monitors) { monitor.decrementUnstableServices(); } if (shutdownListener != null && state == Substate.REMOVED) { shutdownListener.controllerDied(); shutdownListener = null; } } } }
private void updateStabilityState(final boolean leavingStableRestState) { assert holdsLock(this); final boolean enteringStableRestState = state.isRestState() && asyncTasks == 0; if (leavingStableRestState) { if (!enteringStableRestState) { container.incrementUnstableServices(); for (StabilityMonitor monitor : monitors) { monitor.incrementUnstableServices(); } } } else { if (enteringStableRestState) { container.decrementUnstableServices(); for (StabilityMonitor monitor : monitors) { monitor.decrementUnstableServices(); } if (shutdownListener != null && state == Substate.REMOVED) { shutdownListener.controllerDied(); shutdownListener = null; } } } }
private static void transition(final ServiceController<?> targetController, State targetState) throws StartException { // Short-circuit if the service is already at the target state if (targetController.getState() == targetState) return; final StabilityMonitor monitor = new StabilityMonitor(); try { if (targetController.getSubstate().isRestState()) { // Force service to transition to desired state Mode targetMode = modeToggle.get(targetState).get(targetController.getMode()); if (targetMode != null) { targetController.setMode(targetMode); } } monitor.addController(targetController); monitor.awaitStability(); if (targetState == State.UP) { StartException exception = targetController.getStartException(); if (exception != null) { throw exception; } } } catch (InterruptedException e) { Thread.currentThread().interrupt(); } finally { monitor.removeController(targetController); } }
protected void performRuntime(OperationContext context, ModelNode operation, ModelNode model) { PathAddress address = PathAddress.pathAddress(operation.require(OP_ADDR)); String name = address.getLastElement().getValue(); ServiceName svcName = SocketBinding.JBOSS_BINDING_NAME.append(name); ServiceRegistry registry = context.getServiceRegistry(true); ServiceController<?> controller = registry.getService(svcName); ServiceController.Substate substate = controller == null ? null : controller.getSubstate(); if (substate != null && substate.getState() == ServiceController.State.UP && substate.isRestState()) { context.reloadRequired(); } else { context.removeService(SocketBinding.JBOSS_BINDING_NAME.append(name)); } }
protected void performRuntime(OperationContext context, ModelNode operation, ModelNode model) { PathAddress address = PathAddress.pathAddress(operation.require(OP_ADDR)); String name = address.getLastElement().getValue(); ServiceName svcName = SocketBinding.JBOSS_BINDING_NAME.append(name); ServiceRegistry registry = context.getServiceRegistry(true); ServiceController<?> controller = registry.getService(svcName); ServiceController.Substate substate = controller == null ? null : controller.getSubstate(); if (substate != null && substate.getState() == ServiceController.State.UP && substate.isRestState()) { context.reloadRequired(); } else { context.removeService(SocketBinding.JBOSS_BINDING_NAME.append(name)); } }
/** * Determine whether this transition causes movement from a non-rest state to a rest state. * * @return {@code true} if this transition enters a rest state */ public boolean entersRestState() { return ! before.isRestState() && after.isRestState(); }
/** * Determine whether this transition causes movement from a rest state to a non-rest state. * * @return {@code true} if this transition leaves a rest state */ public boolean leavesRestState() { return before.isRestState() && ! after.isRestState(); }
/** * Determine whether this transition causes movement from a non-rest state to a rest state. * * @return {@code true} if this transition enters a rest state */ public boolean entersRestState() { return ! before.isRestState() && after.isRestState(); }
/** * Determine whether this transition causes movement from a rest state to a non-rest state. * * @return {@code true} if this transition leaves a rest state */ public boolean leavesRestState() { return before.isRestState() && ! after.isRestState(); }