Package org.jboss.msc.service
Class StabilityMonitor
java.lang.Object
org.jboss.msc.service.StabilityMonitor
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.NEWSubstate.DOWNSubstate.PROBLEMSubstate.START_FAILEDSubstate.UPSubstate.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:
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidaddController(ServiceController<?> controller) Deprecated.Register controller with this monitor.voidDeprecated.Causes the current thread to wait until the monitor is stable.booleanawaitStability(long timeout, TimeUnit unit) Deprecated.Causes the current thread to wait until the monitor is stable.booleanawaitStability(long timeout, TimeUnit unit, Set<? super ServiceController<?>> failed, Set<? super ServiceController<?>> problems) Deprecated.Causes the current thread to wait until the monitor is stable.booleanawaitStability(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.booleanawaitStability(long timeout, TimeUnit unit, StabilityStatistics statistics) Deprecated.Causes the current thread to wait until the monitor is stable.voidawaitStability(Set<? super ServiceController<?>> failed, Set<? super ServiceController<?>> problems) Deprecated.Causes the current thread to wait until the monitor is stable.voidawaitStability(Set<? super ServiceController<?>> failed, Set<? super ServiceController<?>> problems, StabilityStatistics statistics) Deprecated.Causes the current thread to wait until the monitor is stable.voidawaitStability(StabilityStatistics statistics) Deprecated.Causes the current thread to wait until the monitor is stable.voidclear()Deprecated.Removes all the registered controllers in this monitor.voidremoveController(ServiceController<?> controller) Deprecated.Unregister controller with this monitor.
-
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- ifcontrolleris nullIllegalStateException- ifcontrollers 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- ifcontrolleris nullIllegalStateException- ifcontrollers 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
Deprecated.Causes the current thread to wait until the monitor is stable.- Throws:
InterruptedException- if the current thread is interrupted while waiting
-
awaitStability
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
Deprecated.Causes the current thread to wait until the monitor is stable.- Parameters:
timeout- the maximum time to waitunit- the time unit of thetimeoutargument- 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 thetimeoutargumentstatistics- 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 thetimeoutargumentfailed- 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 thetimeoutargumentfailed- 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
-