org.sadun.util.watchdog.mbean
Interface ManagedWatchDogMBean

All Known Implementing Classes:
ManagedWatchDog

public interface ManagedWatchDogMBean

NON COMPLETE YET. A JMX instrumentation of the WatchDog class.

Version:
1.0
Author:
Cristiano Sadun

Nested Class Summary
static interface ManagedWatchDogMBean.CheckAction
          This interface must is implemented by objects which define a specific check semantics for the default implementation of the ManagedWatchDogMBean.
 
Method Summary
 void addListener(WatchDog.Listener l)
          Add a watchdog listener to the listener set.
 java.lang.String getCheckActionClassName()
          Get the name of the check action class in use.
 java.lang.Object getCheckActionParameter(java.lang.String name)
          Return the value of a parameter in the current check action object.
 long getCheckPeriodTime()
          Return the amount of time the watchdog waits between each check.
 java.lang.String getName()
          Set the name of the watchdog tGread
 boolean isAlive()
          Return true if the watchdog thread is currently running.
 boolean isShuttingDown()
          Return true if a shutdown has been requested.
 boolean isStartBySleeping()
          Return true if the watchdog goes immediatly to sleep on startup
 boolean isSynchronous()
          Return the synchronicity mode (see class comment).
 void removeListener(WatchDog.Listener l)
          Remove a watchdog listener from the listeners set.
 void setCheckActionClassName(java.lang.String name)
          Set the name of the check action class to use.
 void setCheckActionParameter(java.lang.String name, java.lang.Object value)
          Set a parameter on the current check action object.
 void setCheckPeriodTime(long checkPeriodTime)
          Set the amount of time the watchdog waits between each check.
 void setName(java.lang.String name)
          Set the name of the watchdog thread
 void setStartBySleeping(boolean startBySleeping)
           
 void shutdown()
          Unconditionally requests a shutdown.
 void startup()
          Start the watchdog thread.
 

Method Detail

addListener

public void addListener(WatchDog.Listener l)
Add a watchdog listener to the listener set.

Parameters:
l - the listener to add

removeListener

public void removeListener(WatchDog.Listener l)
Remove a watchdog listener from the listeners set.

Parameters:
l - the listener to remove

getCheckPeriodTime

public long getCheckPeriodTime()
Return the amount of time the watchdog waits between each check.

Returns:
the amount of time the watchdog waits between each check.

setCheckPeriodTime

public void setCheckPeriodTime(long checkPeriodTime)
Set the amount of time the watchdog waits between each check.

Parameters:
checkPeriodTime - the amount of time the watchdog waits between each check.

setCheckActionClassName

public void setCheckActionClassName(java.lang.String name)
                             throws javax.management.MBeanException
Set the name of the check action class to use.

The class must have a public default constructor.

This method attempts to create an instance of the class, and a corresponding WatchDog object. An MBeanException is raised in case of problem doing so.

This method can be called only once.

Parameters:
name - the name of the check action class to use.
Throws:
javax.management.MBeanException

getCheckActionClassName

public java.lang.String getCheckActionClassName()
Get the name of the check action class in use.

Returns:
the name of the check action class in use.

isSynchronous

public boolean isSynchronous()
Return the synchronicity mode (see class comment).

Returns:
the synchronicity mode (see class comment).

isStartBySleeping

public boolean isStartBySleeping()
Return true if the watchdog goes immediatly to sleep on startup

Returns:
true if the watchdog goes immediatly to sleep on startup

setStartBySleeping

public void setStartBySleeping(boolean startBySleeping)
Parameters:
startBySleeping - The startBySleeping to set.

setName

public void setName(java.lang.String name)
Set the name of the watchdog thread

Parameters:
name - the name of the watchdog thread

getName

public java.lang.String getName()
Set the name of the watchdog tGread

Returns:
the name of the watchdog thread

startup

public void startup()
Start the watchdog thread.


shutdown

public void shutdown()
Unconditionally requests a shutdown. The runnable will complete its last atomic operation, and gracefully exit the run() method.


isShuttingDown

public boolean isShuttingDown()
Return true if a shutdown has been requested.

Returns:
true if a shutdown has been requested

isAlive

public boolean isAlive()
Return true if the watchdog thread is currently running.

Returns:
true if the watchdog thread is currently running.

setCheckActionParameter

public void setCheckActionParameter(java.lang.String name,
                                    java.lang.Object value)
                             throws javax.management.MBeanException
Set a parameter on the current check action object. The CheckActionClassName attribute must be set to a valid, constructable class before this method is invoked.

Parameters:
name - the name of the check action parameter.
value - the value to set
Throws:
javax.management.MBeanException

getCheckActionParameter

public java.lang.Object getCheckActionParameter(java.lang.String name)
                                         throws javax.management.MBeanException
Return the value of a parameter in the current check action object. The CheckActionClassName attribute must be set to a valid, constructable class before this method is invoked.

Parameters:
name - the name of the check action parameter.
Returns:
the parameter value
Throws:
javax.management.MBeanException