org.jmx4odp.daemonProcess
Class SleepLoop

java.lang.Object
  extended by org.jmx4odp.daemonProcess.SleepLoop
All Implemented Interfaces:
javax.management.MBeanRegistration, SleepLoopMBean

public class SleepLoop
extends java.lang.Object
implements javax.management.MBeanRegistration, SleepLoopMBean

Author:
Lucas McGregor

Constructor Summary
SleepLoop()
          Creates a new instance of SleepLoop
 
Method Summary
 DaemonProcessor getDaemonProcessor()
          The object that is called once per cycle
 int getSleepCount()
          The ammount of time in ms to sleep between each loop.
 void postDeregister()
           
 void postRegister(java.lang.Boolean booleanParam)
           
 void preDeregister()
          Call stopDaemon before deregistering
 javax.management.ObjectName preRegister(javax.management.MBeanServer mBeanServer, javax.management.ObjectName name)
           
 void setDaemonProcessor(DaemonProcessor dp)
          The object that is called once per cycle.
 void setSleepCount(int i)
          The ammount of time in ms to sleep between each loop.
 void startDaemon()
          Stop the server if it is running.
 void stopDaemon()
          If the server is running, stop it.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SleepLoop

public SleepLoop()
Creates a new instance of SleepLoop

Method Detail

setDaemonProcessor

public void setDaemonProcessor(DaemonProcessor dp)
The object that is called once per cycle. If the object already has been set, this will invoke postStop on it before losing its reference.

Specified by:
setDaemonProcessor in interface SleepLoopMBean

getDaemonProcessor

public DaemonProcessor getDaemonProcessor()
The object that is called once per cycle

Specified by:
getDaemonProcessor in interface SleepLoopMBean

setSleepCount

public void setSleepCount(int i)
The ammount of time in ms to sleep between each loop.

Specified by:
setSleepCount in interface SleepLoopMBean

getSleepCount

public int getSleepCount()
The ammount of time in ms to sleep between each loop.

Specified by:
getSleepCount in interface SleepLoopMBean

startDaemon

public void startDaemon()
                 throws java.lang.Exception
Stop the server if it is running. Then call daemonProcessor.preStart(). Then use the daemonProcessor to create a new SleepLoop thread and start it.

Specified by:
startDaemon in interface SleepLoopMBean
Throws:
java.lang.Exception

stopDaemon

public void stopDaemon()
                throws java.lang.Exception
If the server is running, stop it.

Specified by:
stopDaemon in interface SleepLoopMBean
Throws:
java.lang.Exception

postRegister

public void postRegister(java.lang.Boolean booleanParam)
Specified by:
postRegister in interface javax.management.MBeanRegistration

preRegister

public javax.management.ObjectName preRegister(javax.management.MBeanServer mBeanServer,
                                               javax.management.ObjectName name)
                                        throws java.lang.Exception
Specified by:
preRegister in interface javax.management.MBeanRegistration
Throws:
java.lang.Exception

postDeregister

public void postDeregister()
Specified by:
postDeregister in interface javax.management.MBeanRegistration

preDeregister

public void preDeregister()
                   throws java.lang.Exception
Call stopDaemon before deregistering

Specified by:
preDeregister in interface javax.management.MBeanRegistration
Throws:
java.lang.Exception