Class StabilityMonitor

java.lang.Object
org.jboss.msc.service.StabilityMonitor

@Deprecated public final class StabilityMonitor extends Object
Deprecated.
Stability monitors are unreliable - do not use them. This class will be removed in a future release.
A stability detection utility. It can be used to detect if all the registered controllers with StabilityMonitor are in REST state. The following controller substates are considered to be in REST state:
  • Substate.NEW
  • Substate.DOWN
  • Substate.PROBLEM
  • Substate.START_FAILED
  • Substate.UP
  • Substate.REMOVED
Sample bulk usage:
 Set<ServiceController<?>> controllers = ...
 StabilityMonitor monitor = new StabilityMonitor();
 for (ServiceController<?> controller : controllers) {
    monitor.addController(controller);
 }
 try {
    monitor.awaitStability();
 } finally {
    monitor.clear();
    // since now on the monitor can be reused for another stability detection
 }
 // do something after all the controllers are in REST state
 
Sample simple usage:
 ServiceController<?> controller = ...
 StabilityMonitor monitor = new StabilityMonitor();
 monitor.addController(controller);
 controller.setMode(REMOVE);
 try {
    monitor.awaitStability();
 } finally {
    monitor.removeController(controller);
 }
 // do something after controller have been removed from container
 
Author:
David M. Lloyd, Richard Opalka
See Also:
  • Constructor Details

    • StabilityMonitor

      public StabilityMonitor()
      Deprecated.
  • Method Details

    • addController

      public void addController(ServiceController<?> controller) throws IllegalArgumentException, IllegalStateException
      Deprecated.
      Register controller with this monitor.
      Parameters:
      controller - to be registered for stability detection.
      Throws:
      IllegalArgumentException - if controller is null
      IllegalStateException - if controllers lock is held by current thread
    • removeController

      public void removeController(ServiceController<?> controller) throws IllegalArgumentException, IllegalStateException
      Deprecated.
      Unregister controller with this monitor.
      Parameters:
      controller - to be unregistered from stability detection.
      Throws:
      IllegalArgumentException - if controller is null
      IllegalStateException - if controllers lock is held by current thread
    • clear

      public void clear()
      Deprecated.
      Removes all the registered controllers in this monitor. The monitor can be later reused for stability detection again.
    • awaitStability

      public void awaitStability() throws InterruptedException
      Deprecated.
      Causes the current thread to wait until the monitor is stable.
      Throws:
      InterruptedException - if the current thread is interrupted while waiting
    • awaitStability

      public void awaitStability(StabilityStatistics statistics) throws InterruptedException
      Deprecated.
      Causes the current thread to wait until the monitor is stable.
      Parameters:
      statistics - stability statistics report to fill in
      Throws:
      InterruptedException - if the current thread is interrupted while waiting
    • awaitStability

      public boolean awaitStability(long timeout, TimeUnit unit) throws InterruptedException
      Deprecated.
      Causes the current thread to wait until the monitor is stable.
      Parameters:
      timeout - the maximum time to wait
      unit - the time unit of the timeout argument
      Returns:
      true if this monitor achieved stability, false if the timeout elapsed before stability
      Throws:
      InterruptedException - if the current thread is interrupted while waiting
    • awaitStability

      public boolean awaitStability(long timeout, TimeUnit unit, StabilityStatistics statistics) throws InterruptedException
      Deprecated.
      Causes the current thread to wait until the monitor is stable.
      Parameters:
      timeout - the maximum time to wait
      unit - the time unit of the timeout argument
      statistics - stability statistics report to fill in
      Returns:
      true if this monitor achieved stability, false if the timeout elapsed before stability
      Throws:
      InterruptedException - if the current thread is interrupted while waiting
    • awaitStability

      public void awaitStability(Set<? super ServiceController<?>> failed, Set<? super ServiceController<?>> problems) throws InterruptedException
      Deprecated.
      Causes the current thread to wait until the monitor is stable.
      Parameters:
      failed - a set into which failed services should be copied
      problems - a set into which problem services should be copied
      Throws:
      InterruptedException - if the current thread is interrupted while waiting
    • awaitStability

      public boolean awaitStability(long timeout, TimeUnit unit, Set<? super ServiceController<?>> failed, Set<? super ServiceController<?>> problems) throws InterruptedException
      Deprecated.
      Causes the current thread to wait until the monitor is stable.
      Parameters:
      timeout - the maximum time to wait
      unit - the time unit of the timeout argument
      failed - a set into which failed services should be copied
      problems - a set into which problem services should be copied
      Returns:
      true if this monitor achieved stability, false if the timeout elapsed before stability
      Throws:
      InterruptedException - if the current thread is interrupted while waiting
    • awaitStability

      public void awaitStability(Set<? super ServiceController<?>> failed, Set<? super ServiceController<?>> problems, StabilityStatistics statistics) throws InterruptedException
      Deprecated.
      Causes the current thread to wait until the monitor is stable.
      Parameters:
      failed - a set into which failed services should be copied
      problems - a set into which problem services should be copied
      statistics - stability statistics report to fill in
      Throws:
      InterruptedException - if the current thread is interrupted while waiting
    • awaitStability

      public boolean awaitStability(long timeout, TimeUnit unit, Set<? super ServiceController<?>> failed, Set<? super ServiceController<?>> problems, StabilityStatistics statistics) throws InterruptedException
      Deprecated.
      Causes the current thread to wait until the monitor is stable.
      Parameters:
      timeout - the maximum time to wait
      unit - the time unit of the timeout argument
      failed - a set into which failed services should be copied
      problems - a set into which problem services should be copied
      statistics - stability statistics report to fill in
      Returns:
      true if this monitor achieved stability, false if the timeout elapsed before stability
      Throws:
      InterruptedException - if the current thread is interrupted while waiting