|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectjava.lang.Thread
ti.pub.WorkerThread
public class WorkerThread
A worker thread is a thread that runs queued runnables, in a FIFO manner.
Nested Class Summary |
---|
Nested classes/interfaces inherited from class java.lang.Thread |
---|
java.lang.Thread.State, java.lang.Thread.UncaughtExceptionHandler |
Field Summary |
---|
Fields inherited from class java.lang.Thread |
---|
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY |
Constructor Summary | |
---|---|
WorkerThread(int pri)
Class Constructor. |
|
WorkerThread(int pri,
long watchdogTimeout)
Class Constructor. |
|
WorkerThread(java.lang.String name,
int pri,
long watchdogTimeout)
Class Constructor. |
Method Summary | |
---|---|
void |
invokeLater(java.lang.Runnable r)
Enqueue a work unit (a runnable) to be invoked from the context of the worker thread |
void |
run()
thread-main |
void |
run(java.lang.Runnable r)
|
void |
runNext(long timeout)
Run the next work unit (runnable). |
void |
unhandledException(java.lang.Throwable e)
Called when unhandled errors occur. |
void |
watchdogTimeoutExceeded()
If using the watchdog timer, this is called from some other thread context when the timeout set for executing a runnable has been exceeded. |
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 |
Constructor Detail |
---|
public WorkerThread(int pri)
pri
- the prioritypublic WorkerThread(int pri, long watchdogTimeout)
pri
- the prioritywatchdogTimeout
- the watchdog timeout, if a runnable takes
longer than this many ms to complete, the watchdogTimeoutExceeded()
method will be called from some other thread context. A value of
0
indicates no time limitpublic WorkerThread(java.lang.String name, int pri, long watchdogTimeout)
name
- the thread namepri
- the prioritywatchdogTimeout
- the watchdog timeout, if a runnable takes
longer than this many ms to complete, the watchdogTimeoutExceeded()
method will be called from some other thread context. A value of
0
indicates no time limitMethod Detail |
---|
public void run()
run
in interface java.lang.Runnable
run
in class java.lang.Thread
public void run(java.lang.Runnable r)
public void unhandledException(java.lang.Throwable e)
public void watchdogTimeoutExceeded()
public void runNext(long timeout) throws java.lang.InterruptedException
This should only be called from the context of this worker thread.
timeout
- the maximum number of ms to wait for the next work item.
A value of 0
indicates to wait forever
java.lang.InterruptedException
public void invokeLater(java.lang.Runnable r)
r
- the runnable
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |