Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

org.jbossmx.cluster.watchdog.mbean
Class Startable  view Startable download Startable.java

java.lang.Object
  extended byorg.jbossmx.cluster.watchdog.mbean.Startable
All Implemented Interfaces:
org.jbossmx.cluster.watchdog.util.SkinableMBean, StartableMBean
Direct Known Subclasses:
Test1, Watchdog

public abstract class Startable
extends java.lang.Object
implements StartableMBean

Base class for MBeans that can be monitored


Field Summary
static int FAILED
          A Failed MBean State
static int FAILED_TO_START
          A Failed to Start MBean State
static int FAILED_TO_STOP
          A Failed to Stop MBean State
private static Log LOG
           
private  int m_provisionalState
          The provisional state of the MBean
static java.lang.String[] m_sStateStrings
          The String representation of the states
static int RESTARTING
          A Restarting MBean State
static int RUNNING
          A Running MBean State
static int STARTING
          A Starting MBean State
static int STOPPED
          A Stopped MBean State
static int STOPPING
          A Stopping MBean State
 
Constructor Summary
Startable()
          Constructor for Startable
 
Method Summary
private  int getMBeanProvisionalState()
          Gets the provisional state of the MBean
 java.lang.String getMBeanStateString()
          Gets the state of the MBean as a String
static java.lang.String getStateAsString(int state)
          Converts state to a String
protected abstract  boolean hasMBeanFailed()
           
 boolean restartMBean()
          Restart an MBean, delegates implementation to restartMBeanImpl.
protected abstract  boolean restartMBeanImpl()
           
 int retrieveMBeanState()
          Gets the state of the MBean
 java.lang.String retrieveOneLiner(java.lang.String defaultString)
           
private  void setMBeanProvisionalState(int provisionalState)
          Sets the provisional state of the MBean
 void simulateFailure()
          Simulates failure in the MBean.
 boolean startMBean()
          Starts the MBean, delegates implementation to the startMBeanImpl method.
protected abstract  boolean startMBeanImpl()
           
 boolean stopMBean()
          Stops the MBean, delegates implementation to the stopMBeanImpl method.
protected abstract  boolean stopMBeanImpl()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

m_provisionalState

private int m_provisionalState
The provisional state of the MBean


FAILED_TO_STOP

public static final int FAILED_TO_STOP
A Failed to Stop MBean State

See Also:
Constant Field Values

FAILED_TO_START

public static final int FAILED_TO_START
A Failed to Start MBean State

See Also:
Constant Field Values

FAILED

public static final int FAILED
A Failed MBean State

See Also:
Constant Field Values

STOPPED

public static final int STOPPED
A Stopped MBean State

See Also:
Constant Field Values

STARTING

public static final int STARTING
A Starting MBean State

See Also:
Constant Field Values

RUNNING

public static final int RUNNING
A Running MBean State

See Also:
Constant Field Values

STOPPING

public static final int STOPPING
A Stopping MBean State

See Also:
Constant Field Values

RESTARTING

public static final int RESTARTING
A Restarting MBean State

See Also:
Constant Field Values

m_sStateStrings

public static final java.lang.String[] m_sStateStrings
The String representation of the states


LOG

private static Log LOG
Constructor Detail

Startable

public Startable()
Constructor for Startable

Method Detail

startMBean

public final boolean startMBean()
Starts the MBean, delegates implementation to the startMBeanImpl method. The MBean will go through several states:

(STOPPED | FAILED_TO_START) -> STARTING -> (RUNNING | FAILED_TO_START)

Specified by:
startMBean in interface StartableMBean

stopMBean

public final boolean stopMBean()
Stops the MBean, delegates implementation to the stopMBeanImpl method. The MBean will go through several states:

(RUNNING | FAILED_TO_STOP) -> STOPPING -> (STOPPED | FAILED_TO_STOP)

Specified by:
stopMBean in interface StartableMBean

restartMBean

public final boolean restartMBean()
Restart an MBean, delegates implementation to restartMBeanImpl. The MBean will go through several states:

FAILED -> RESTARTING -> (RUNNING | FAILED)

Specified by:
restartMBean in interface StartableMBean

retrieveMBeanState

public final int retrieveMBeanState()
Gets the state of the MBean

Specified by:
retrieveMBeanState in interface StartableMBean

getMBeanStateString

public final java.lang.String getMBeanStateString()
Gets the state of the MBean as a String

Specified by:
getMBeanStateString in interface StartableMBean

simulateFailure

public final void simulateFailure()
Simulates failure in the MBean.

Specified by:
simulateFailure in interface StartableMBean

retrieveOneLiner

public java.lang.String retrieveOneLiner(java.lang.String defaultString)
Specified by:
retrieveOneLiner in interface org.jbossmx.cluster.watchdog.util.SkinableMBean

setMBeanProvisionalState

private final void setMBeanProvisionalState(int provisionalState)
Sets the provisional state of the MBean


getMBeanProvisionalState

private final int getMBeanProvisionalState()
Gets the provisional state of the MBean


getStateAsString

public static final java.lang.String getStateAsString(int state)
Converts state to a String


startMBeanImpl

protected abstract boolean startMBeanImpl()
                                   throws java.lang.Exception

stopMBeanImpl

protected abstract boolean stopMBeanImpl()
                                  throws java.lang.Exception

restartMBeanImpl

protected abstract boolean restartMBeanImpl()
                                     throws java.lang.Exception

hasMBeanFailed

protected abstract boolean hasMBeanFailed()
                                   throws java.lang.Exception