|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectjava.lang.Thread
org.elite.jdcbot.util.TimerThread
public abstract class TimerThread
Simple abstract class for generating OnTimer event. You are encouraged to extends this thread with your own class (example is FloodMessageThread) since it enables you to have more than one onTimer event. So you would have one class which prints users joined hub on every hour on main chat and another that prints current weather on every two hours.
Nested Class Summary |
---|
Nested classes/interfaces inherited from class java.lang.Thread |
---|
java.lang.Thread.State, java.lang.Thread.UncaughtExceptionHandler |
Field Summary | |
---|---|
protected jDCBot |
_bot
|
private long |
_startup_wait_time
|
private long |
_wait_time
|
private boolean |
running
|
Fields inherited from class java.lang.Thread |
---|
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY |
Constructor Summary | |
---|---|
TimerThread(jDCBot bot,
long wait_time,
java.lang.String ThreadName)
Constructs new thread that triggers onTimer event. |
|
TimerThread(jDCBot bot,
long wait_time,
java.lang.String ThreadName,
long startup_wait_time)
|
Method Summary | |
---|---|
protected void |
onTimer()
Called every wait_time |
protected void |
onTimerStart()
|
void |
run()
|
void |
stopIt()
Stops the thread. |
Methods inherited from class java.lang.Thread |
---|
activeCount, checkAccess, countStackFrames, currentThread, destroy, dumpStack, enumerate, getAllStackTraces, getContextClassLoader, getDefaultUncaughtExceptionHandler, getId, getName, getPriority, getStackTrace, getState, getThreadGroup, getUncaughtExceptionHandler, holdsLock, interrupt, interrupted, isAlive, isDaemon, isInterrupted, join, join, join, resume, setContextClassLoader, setDaemon, setDefaultUncaughtExceptionHandler, setName, setPriority, setUncaughtExceptionHandler, sleep, sleep, start, stop, stop, suspend, toString, yield |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
private long _wait_time
private long _startup_wait_time
protected jDCBot _bot
private volatile boolean running
Constructor Detail |
---|
public TimerThread(jDCBot bot, long wait_time, java.lang.String ThreadName)
bot
- jDCBot instance needed to send messages...wait_time
- Time (in ms) between triggers.public TimerThread(jDCBot bot, long wait_time, java.lang.String ThreadName, long startup_wait_time)
Method Detail |
---|
public void run()
run
in interface java.lang.Runnable
run
in class java.lang.Thread
protected void onTimer()
The implementation of this method in the TimerThread abstract class performs no actions and may be overridden as required.
protected void onTimerStart()
public void stopIt()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |