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);
}
}
Aggregations