|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--java.lang.Thread | +--org.shlublu.javax.lang.BasicThread
Creation : 29 oct 2001 Convenience class dedicated to implement threads. The run() method is defined to call startup, iteration, cleanup/crashcleanup methods. Those threads can be stopped by calling a method.
Fields inherited from class java.lang.Thread |
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY |
Constructor Summary | |
BasicThread()
Empty ctor |
|
BasicThread(java.lang.String strName)
Ctor |
Method Summary | |
protected abstract void |
doCleanup()
This method is called just after the last mainloop turn. |
protected abstract void |
doCrashCleanup()
This method is called in case of mainloop crash. |
protected abstract void |
doIteration()
This method is called each mainloop turn. |
protected abstract void |
doStartup()
This method is called just before the first mainloop turn. |
java.lang.Exception |
getCrashReason()
Get the caught Exception in case of crash, null otherwise |
void |
run()
Run implementation : try { doStartup(); while (bAlive) { doIteration(); yield(); } doCleanup(); } catch (Exception e) { eCauseOfDeath = e; doCrashCleanup(); } |
void |
stopJob()
Stop this thread |
Methods inherited from class java.lang.Thread |
activeCount, checkAccess, countStackFrames, currentThread, destroy, dumpStack, enumerate, getContextClassLoader, getName, getPriority, getThreadGroup, interrupt, interrupted, isAlive, isDaemon, isInterrupted, join, join, join, resume, setContextClassLoader, setDaemon, setName, setPriority, 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 |
Constructor Detail |
public BasicThread()
public BasicThread(java.lang.String strName)
String
- strName the name of tyhe threadMethod Detail |
public final void run()
try { doStartup(); while (bAlive) { doIteration(); yield(); } doCleanup(); } catch (Exception e) { eCauseOfDeath = e; doCrashCleanup(); }
run
in class java.lang.Thread
protected abstract void doIteration() throws java.lang.Exception
java.lang.Exception
- all exceptions are caught by run()run()
protected abstract void doStartup() throws java.lang.Exception
java.lang.Exception
- all exceptions are caught by run()run()
protected abstract void doCleanup() throws java.lang.Exception
java.lang.Exception
- all exceptions are caught by run()run()
,
stopJob()
protected abstract void doCrashCleanup()
run()
public void stopJob()
public final java.lang.Exception getCrashReason()
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |