org.sadun.util.watchdog.mbean
Interface ManagedWatchDogMBean.CheckAction

All Known Implementing Classes:
ConnectURLAction
Enclosing interface:
ManagedWatchDogMBean

public static interface ManagedWatchDogMBean.CheckAction

This interface must is implemented by objects which define a specific check semantics for the default implementation of the ManagedWatchDogMBean.

Unless is used programmatically, a check action should have an empty constructor and accessors for its properties.

Version:
1.0
Author:
Cristiano Sadun

Method Summary
 java.lang.Throwable doCheck(java.lang.Object obj)
          Perform the required check.
 java.lang.String isReady(boolean running)
          Performs a check on whether or not the action is ready, and returns a description of the problem if a problem exist, otherwise null.
 

Method Detail

isReady

public java.lang.String isReady(boolean running)
Performs a check on whether or not the action is ready, and returns a description of the problem if a problem exist, otherwise null.

For actions whose parameters may be checked at runtime, this is the place where to put validation checks for such parameters.

Parameters:
running - if true, the object using the action is declared as running.
Returns:
null if the action is ready. A description of the problem if it is not.

doCheck

public java.lang.Throwable doCheck(java.lang.Object obj)
                            throws WatchDogException
Perform the required check. This method must return a Throwable object if the check fails, and raise a WatchDogExceptionif the check proves impossible.

In either case, the currently registered listeners will be notified of the failure.

Parameters:
obj - the object subject to the check, or null if the check does not depend on any specific object.
Returns:
a Throwable object, if the check fails
Throws:
WatchDogException - if the check is impossible