|
ProgramixGenericLib v5.0.1 | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcom.programix.thread.ThreadTools
public class ThreadTools
Handy and commonly used tools for working with multithreaded code.
For advanced tools and utilities related to multithreading, please check out JThreadKit.
| Field Summary | |
|---|---|
static long |
NO_TIMEOUT
Indicates that the 'waiting' should not time out (no matter how much time elapses). |
static boolean |
SUCCESS
Signals that the attempted operation was successful. |
static boolean |
TIMED_OUT
Signals that the attempted operation ran out of time. |
| Method Summary | |
|---|---|
static void |
nap(long msDuration)
Causes the calling thread to go to sleep for the specified amount of time. |
static void |
napRandom(long msMinDuration,
long msMaxDuration)
Causes the calling thread to go to sleep for a random amount of time in the specified range of time. |
static void |
out(Object msg)
Prints the specified message prefixed with the elapsed time and the name of the calling thread. |
static void |
outln(Object msg)
Prints the specified message prefixed with the elapsed time and the name of the calling thread. |
static void |
println(Object message)
Prints the specified message prefixed with the name of the calling thread to System.out.println (standard out). |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public static final long NO_TIMEOUT
public static final boolean SUCCESS
public static final boolean TIMED_OUT
| Method Detail |
|---|
public static void println(Object message)
message - the message to print printed.public static void out(Object msg)
LineLogger held by ThreadTools (if
you need more flexibility, then use LineLogger directly).
public static void outln(Object msg)
LineLogger held by ThreadTools (if
you need more flexibility, then use LineLogger directly).
public static void nap(long msDuration)
throws InterruptException
InterruptException is thrown (note that this is a
RuntimeException so callers are not required to catch it).
msDuration - the number of milliseconds to sleep for.
InterruptException - if the nap is interrupted.
public static void napRandom(long msMinDuration,
long msMaxDuration)
throws InterruptException
InterruptException is thrown (note that this is a
RuntimeException so callers are not required to catch it).
msMinDuration - the minimum number of milliseconds to sleep for.msMaxDuration - the maximum number of milliseconds to sleep for.
InterruptException - if the nap is interrupted.
|
ProgramixGenericLib v5.0.1 | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||