|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectjava.lang.Thread
com.partnersoft.gadgets.TriggeredThread
public class TriggeredThread
Takes care of the (surprisingly annoying) case of running a task on a separate thread whenever some event occurs. It waits otherwise.
| 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 | |
|---|---|
TriggeredThread()
|
|
TriggeredThread(java.lang.String name)
|
|
TriggeredThread(java.lang.String name,
java.lang.Runnable task)
|
|
| Method Summary | |
|---|---|
double |
getMeasuredSpeed()
Total measured speed, in runs per second. |
double |
getRecentMeasuredSpeed()
Actual task frequency, in runs per second, over the last 100 samples. |
java.lang.Runnable |
getTask()
|
void |
run()
|
void |
runTask()
By default, this runs the runnable. |
void |
setTask(java.lang.Runnable newTask)
|
void |
stopRunning()
Tells the thread to quit looping. |
void |
trigger()
Tickles the thread and tells it to run its action. |
| 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 TriggeredThread()
public TriggeredThread(java.lang.String name)
public TriggeredThread(java.lang.String name,
java.lang.Runnable task)
| Method Detail |
|---|
public void run()
run in interface java.lang.Runnablerun in class java.lang.Threadpublic void trigger()
public void runTask()
throws java.lang.Exception
java.lang.Exceptionpublic void stopRunning()
public void setTask(java.lang.Runnable newTask)
public java.lang.Runnable getTask()
public double getMeasuredSpeed()
public double getRecentMeasuredSpeed()
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||