org.jmx4odp.j4oNet
Class AutoStartThread

java.lang.Object
  extended by org.jmx4odp.j4oNet.AutoStartThread

public abstract class AutoStartThread
extends java.lang.Object

This object starts an internal thread upon creation. This thread will wake up and call doCycle, then sleep for getThreadSleepCount ms. Stop stops the while loop running in the thread and then nulls out the internal thread, thus freeing any resources.

Author:
Lucas McGregor

Constructor Summary
AutoStartThread()
          creates an internal thread, calls initThread, and then starts the thread in a a while(true) loop.
 
Method Summary
abstract  void doCycle()
          This is overridden by the extending class.
 int getThreadSleepCount()
          Get the number of ms the while loop sleeps between cycles.
 void setThreadSleepCount(int i)
          Set the number of ms the while loop sleeps between cycles.
 void stopWork()
          Stops the while(true) in the internal thread, then nulls out the reference to the internak thread.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AutoStartThread

public AutoStartThread()
                throws java.lang.Exception
creates an internal thread, calls initThread, and then starts the thread in a a while(true) loop.

Throws:
java.lang.Exception
Method Detail

stopWork

public void stopWork()
Stops the while(true) in the internal thread, then nulls out the reference to the internak thread.


getThreadSleepCount

public int getThreadSleepCount()
Get the number of ms the while loop sleeps between cycles.


setThreadSleepCount

public void setThreadSleepCount(int i)
Set the number of ms the while loop sleeps between cycles.


doCycle

public abstract void doCycle()
This is overridden by the extending class. It is called once per cycle by the internal thread.