Search in sources :

Example 1 with Mode

use of org.jboss.msc.service.ServiceController.Mode in project wildfly by wildfly.

the class ServiceContainerHelper method transition.

private static <T> void transition(final ServiceController<T> targetController, final State targetState) {
    // Short-circuit if the service is already at the target state
    if (targetController.getState() == targetState)
        return;
    StabilityMonitor monitor = new StabilityMonitor();
    monitor.addController(targetController);
    try {
        // Force service to transition to desired state
        Mode targetMode = modeToggle.get(targetState).get(targetController.getMode());
        if (targetMode != null) {
            targetController.setMode(targetMode);
        }
        monitor.awaitStability();
    } catch (InterruptedException e) {
        Thread.currentThread().interrupt();
    } finally {
        monitor.removeController(targetController);
    }
}
Also used : Mode(org.jboss.msc.service.ServiceController.Mode) StabilityMonitor(org.jboss.msc.service.StabilityMonitor)

Aggregations

Mode (org.jboss.msc.service.ServiceController.Mode)1 StabilityMonitor (org.jboss.msc.service.StabilityMonitor)1