/** * Register controller with this monitor but don't call serviceController.addMonitor() at all. * * @param controller to be registered for stability detection. */ void addControllerNoCallback(final ServiceControllerImpl<?> controller) { synchronized (controllersLock) { awaitCleanupCompletion(); controllers.add(controller); } }
/** * Register controller with this monitor but don't call serviceController.addMonitor() at all. * * @param controller to be registered for stability detection. */ void addControllerNoCallback(final ServiceControllerImpl<?> controller) { synchronized (controllersLock) { awaitCleanupCompletion(); controllers.add(controller); } }
/** * Register controller with this monitor. * * @param controller to be registered for stability detection. * @throws java.lang.IllegalArgumentException if {@code controller} is null * @throws java.lang.IllegalStateException if {@code controller}s lock is held by current thread */ public void addController(final ServiceController<?> controller) throws IllegalArgumentException, IllegalStateException { if (controller == null) { throw new IllegalArgumentException("Controller is null"); } if (holdsLock(controller)) { throw new IllegalStateException("Controller lock is held"); } final ServiceControllerImpl<?> serviceController = (ServiceControllerImpl<?>) controller; final boolean addMonitorToController; synchronized (controllersLock) { awaitCleanupCompletion(); awaitAddCompletion(); addInProgress = addMonitorToController = controllers.add(serviceController); } if (!addMonitorToController) return; serviceController.addMonitor(this); synchronized (controllersLock) { addInProgress = false; controllersLock.notifyAll(); } }
/** * Register controller with this monitor. * * @param controller to be registered for stability detection. * @throws java.lang.IllegalArgumentException if {@code controller} is null * @throws java.lang.IllegalStateException if {@code controller}s lock is held by current thread */ public void addController(final ServiceController<?> controller) throws IllegalArgumentException, IllegalStateException { if (controller == null) { throw new IllegalArgumentException("Controller is null"); } if (holdsLock(controller)) { throw new IllegalStateException("Controller lock is held"); } final ServiceControllerImpl<?> serviceController = (ServiceControllerImpl<?>) controller; final boolean addMonitorToController; synchronized (controllersLock) { awaitCleanupCompletion(); awaitAddCompletion(); addInProgress = addMonitorToController = controllers.add(serviceController); } if (!addMonitorToController) return; serviceController.addMonitor(this); synchronized (controllersLock) { addInProgress = false; controllersLock.notifyAll(); } }