Package org.jboss.msc.service
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 withStabilityMonitor
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
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:
StabilityStatistics
-
-
Constructor Summary
Constructors Constructor Description StabilityMonitor()
Deprecated.
-
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description void
addController(ServiceController<?> controller)
Deprecated.Register controller with this monitor.void
awaitStability()
Deprecated.Causes the current thread to wait until the monitor is stable.boolean
awaitStability(long timeout, TimeUnit unit)
Deprecated.Causes the current thread to wait until the monitor is stable.boolean
awaitStability(long timeout, TimeUnit unit, Set<? super ServiceController<?>> failed, Set<? super ServiceController<?>> problems)
Deprecated.Causes the current thread to wait until the monitor is stable.boolean
awaitStability(long timeout, TimeUnit unit, Set<? super ServiceController<?>> failed, Set<? super ServiceController<?>> problems, StabilityStatistics statistics)
Deprecated.Causes the current thread to wait until the monitor is stable.boolean
awaitStability(long timeout, TimeUnit unit, StabilityStatistics statistics)
Deprecated.Causes the current thread to wait until the monitor is stable.void
awaitStability(Set<? super ServiceController<?>> failed, Set<? super ServiceController<?>> problems)
Deprecated.Causes the current thread to wait until the monitor is stable.void
awaitStability(Set<? super ServiceController<?>> failed, Set<? super ServiceController<?>> problems, StabilityStatistics statistics)
Deprecated.Causes the current thread to wait until the monitor is stable.void
awaitStability(StabilityStatistics statistics)
Deprecated.Causes the current thread to wait until the monitor is stable.void
clear()
Deprecated.Removes all the registered controllers in this monitor.void
removeController(ServiceController<?> controller)
Deprecated.Unregister controller with this monitor.
-
-
-
Method Detail
-
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
- ifcontroller
is nullIllegalStateException
- ifcontroller
s 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
- ifcontroller
is nullIllegalStateException
- ifcontroller
s 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 waitunit
- the time unit of thetimeout
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 waitunit
- the time unit of thetimeout
argumentstatistics
- 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 copiedproblems
- 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 waitunit
- the time unit of thetimeout
argumentfailed
- a set into which failed services should be copiedproblems
- 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 copiedproblems
- a set into which problem services should be copiedstatistics
- 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 waitunit
- the time unit of thetimeout
argumentfailed
- a set into which failed services should be copiedproblems
- a set into which problem services should be copiedstatistics
- 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
-
-