Refine search
@Override public void transition(ServiceController< ? extends S> controller, Transition transition) { if(transition.getAfter().equals(Substate.UP)) { serviceAvailable(); synchronized(this) { this.notifyAll(); } } else if(transition.getAfter().equals(Substate.CANCELLED)){ synchronized(this) { cancelled = true; this.notifyAll(); } } else if(transition.getAfter().equals(Substate.START_FAILED)) { synchronized (this) { failed = true; this.notifyAll(); } } }
@SuppressWarnings({ "rawtypes", "unchecked" }) public void transition(ServiceController controller, Transition transition) { if(!typeToTrack.isParentOf(controller.getName())) { return; } if(transition.getAfter().getState().equals(State.UP)) { serviceCollection.add((S) controller.getValue()); } else { serviceCollection.remove(controller.getValue()); } }
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); } }
@Override public void transition(ServiceController<?> controller, ServiceController.Transition transition) { if (transition.getAfter().getState() == ServiceController.State.DOWN) { final ServiceName moduleServiceName = ServiceModuleLoader.moduleServiceName(classLoader.getModule().getIdentifier()); container.addListener(new AbstractServiceListener<Object>() { final ServiceName deploymentCompleteName = controller.getName().append(DeploymentCompleteServiceProcessor.SERVICE_NAME); container.addListener(new AbstractServiceListener<Object>() { @Override controller.setMode(ServiceController.Mode.ACTIVE); controller.removeListener(this);
@Override public void transition(final ServiceController<?> controller, final ServiceController.Transition transition) { if(transition.getAfter().equals(ServiceController.Substate.DOWN)) { controller.setMode(Mode.ACTIVE); controller.removeListener(this); } } });
@Override public void transition(ServiceController<?> controller, ServiceController.Transition transition) { if (transition.getAfter().equals(ServiceController.Substate.START_FAILED)) { log.errorf(controller.getStartException(), "Unable to start service: %s", controller.getName()); } } });
case STARTING_to_START_FAILED: { synchronized (this) { failedControllers.put(controller, controller.getStartException().toString()); final ServiceController.Substate after = transition.getAfter(); if (before.isRestState() && ! after.isRestState()) { untick(); } else if (! before.isRestState() && after.isRestState()) { tick();
public synchronized void listenerAdded(final ServiceController<?> controller) { set.add(controller); if (!controller.getSubstate().isRestState()) { outstanding++; } }
@Override public void transition(ServiceController< ? extends S> controller, Transition transition) { if(transition.getAfter().equals(Substate.UP)) { serviceAvailable(); synchronized(this) { this.notifyAll(); } } else if(transition.getAfter().equals(Substate.CANCELLED)){ synchronized(this) { cancelled = true; this.notifyAll(); } } else if(transition.getAfter().equals(Substate.START_FAILED)) { synchronized (this) { failed = true; this.notifyAll(); } } }
@Override public void transition(ServiceController< ? extends S> controller, Transition transition) { if(transition.getAfter().equals(Substate.UP)) { serviceAvailable(); synchronized(this) { this.notifyAll(); } } else if(transition.getAfter().equals(Substate.CANCELLED)){ synchronized(this) { cancelled = true; this.notifyAll(); } } else if(transition.getAfter().equals(Substate.START_FAILED)) { synchronized (this) { failed = true; this.notifyAll(); } } }
/** * Return {@code true} only if this service controller installation is committed. * * @return true if this service controller installation is committed */ boolean isInstallationCommitted() { assert holdsLock(this); // should not be NEW nor CANCELLED return state.compareTo(Substate.CANCELLED) > 0; }
private void internalSetMode(final Mode newMode) { assert holdsLock(this); final ServiceController.Mode oldMode = mode; if (oldMode == Mode.REMOVE) { if (state.compareTo(Substate.REMOVING) >= 0) { throw new IllegalStateException("Service already removed"); } } mode = newMode; }
/** * 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(); }
void addChild(final ServiceControllerImpl<?> child) { assert !holdsLock(this); synchronized (this) { if (state.getState() != State.STARTING && state.getState() != State.UP) { throw new IllegalStateException("Children cannot be added in state " + state.getState()); } children.add(child); newDependent(child); } }
/** * 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(); }
public ServiceController.State getState() { synchronized (this) { return state.getState(); } }