|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectnl.knowledgeplaza.util.ThreadUtil
public class ThreadUtil
This class provides a thread local stop flag, which a thread may query to see if it needs to stop. Aside for the stopflag it also implements a thread related store and some utility methods.
| Field Summary | |
|---|---|
static java.lang.String |
SOURCECODE_VERSION
Standard variable for determining version of a class file. |
| Constructor Summary | |
|---|---|
ThreadUtil()
|
|
| Method Summary | |
|---|---|
static java.lang.Object |
get(java.lang.Runnable runnable,
java.lang.String key)
fetch a specific value for this thread |
static java.lang.Object |
get(java.lang.String key)
|
static java.lang.Object |
get(java.lang.ThreadGroup runnable,
java.lang.String key)
fetch a specific value for this thread |
static java.lang.String |
getStackTrace()
get the stack trace of the current thread as a String |
static boolean |
getStopFlag()
query the stop flag for the current thread |
static boolean |
getStopFlag(java.lang.Runnable pRunnable)
query the stop flag for the specified Thread/Runnable |
static void |
main(java.lang.String[] args)
|
static boolean |
mayContinue()
may the current thread continue |
static boolean |
mustStop()
should the current thread stop |
static java.lang.Object |
remove(java.lang.Runnable runnable,
java.lang.String key)
Remove a specific value for this thread |
static java.lang.Object |
remove(java.lang.String key)
|
static void |
remove(java.lang.ThreadGroup runnable,
java.lang.String key)
Remove a specific value for this thread |
static java.lang.Thread |
replaceThread(java.lang.Thread originalThread,
java.lang.String name,
java.lang.Runnable newRunnable)
Replace a thread with a new one (that is: the old thread is order to stop using the StopFlag and only then the new thread is allowed to commence) Note: the new thread is created immediatly, it only waits for the old one to stop. |
void |
runDelayed(int milleseconds,
java.lang.Runnable runnable)
Execute something delayed |
static void |
setStopFlag(boolean pStop)
set the stop flag for the current thread |
static void |
setStopFlag(java.lang.Runnable pRunnable,
boolean pStop)
set the stop flag for the specified Thread/Runnable |
static void |
sleep(int milliseconds)
Thread.sleep with an ignored InterruptedException |
static void |
sleep(long milliseconds)
Thread.sleep with an ignored InterruptedException |
static void |
sleepForced(int milliseconds)
Thread.sleep where an InterruptedException does not exit sleep |
static void |
sleepForced(long sleeptime)
Thread.sleep where an InterruptedException does not exit sleep |
static void |
store(java.lang.Runnable runnable,
java.lang.String key,
java.lang.Object value)
Store a specific value for this thread |
static void |
store(java.lang.String key,
java.lang.Object value)
|
static void |
store(java.lang.ThreadGroup runnable,
java.lang.String key,
java.lang.Object value)
Store a specific value for this thread |
static void |
waitForThreadToFinish(java.lang.Thread thread)
Wait indefinitely for a thread to finish. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public static final java.lang.String SOURCECODE_VERSION
| Constructor Detail |
|---|
public ThreadUtil()
| Method Detail |
|---|
public static boolean mayContinue()
public static boolean mustStop()
public static boolean getStopFlag()
public static void setStopFlag(boolean pStop)
public static boolean getStopFlag(java.lang.Runnable pRunnable)
public static void setStopFlag(java.lang.Runnable pRunnable,
boolean pStop)
public static void store(java.lang.Runnable runnable,
java.lang.String key,
java.lang.Object value)
public static void store(java.lang.String key,
java.lang.Object value)
public static java.lang.Object get(java.lang.Runnable runnable,
java.lang.String key)
public static java.lang.Object get(java.lang.String key)
public static java.lang.Object remove(java.lang.Runnable runnable,
java.lang.String key)
public static java.lang.Object remove(java.lang.String key)
public static void store(java.lang.ThreadGroup runnable,
java.lang.String key,
java.lang.Object value)
public static java.lang.Object get(java.lang.ThreadGroup runnable,
java.lang.String key)
public static void remove(java.lang.ThreadGroup runnable,
java.lang.String key)
public static void sleep(int milliseconds)
milliseconds - public static void sleep(long milliseconds)
milliseconds - public static void sleepForced(int milliseconds)
milliseconds - public static void sleepForced(long sleeptime)
sleeptime - in millisecondspublic static void waitForThreadToFinish(java.lang.Thread thread)
thread - public static java.lang.String getStackTrace()
public static java.lang.Thread replaceThread(java.lang.Thread originalThread,
java.lang.String name,
java.lang.Runnable newRunnable)
public void runDelayed(int milleseconds,
java.lang.Runnable runnable)
milleseconds - runnable - public static void main(java.lang.String[] args)
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||