textbender.g.lang
Class ThreadX
java.lang.Object
java.lang.Thread
ThreadX
- All Implemented Interfaces:
- Runnable
public final class ThreadX
- extends Thread
Thread extensions and utilities.
Method Summary |
boolean |
tryJoin()
Same as join(), but returns normally if interrupted. |
boolean |
tryJoin(long milliseconds)
Same as join(milliseconds), but returns normally if interrupted. |
static boolean |
trySleep(long milliseconds)
Same as sleep(milliseconds), but an interruption merely cuts short the sleep. |
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, run, setContextClassLoader, setDaemon, setDefaultUncaughtExceptionHandler, setName, setPriority, setUncaughtExceptionHandler, sleep, sleep, start, stop, stop, suspend, toString, yield |
UNCAUGHT_EXCEPTION_LOGGER
public static final Thread.UncaughtExceptionHandler UNCAUGHT_EXCEPTION_LOGGER
- A handler that logs uncaught errors and exceptions
using the thread's associated logger.
UNCAUGHT_EXCEPTION_PRINTER
public static final Thread.UncaughtExceptionHandler UNCAUGHT_EXCEPTION_PRINTER
- A handler that prints stack traces of uncaught errors and exceptions
to the standard error stream. Similar to the default behaviour
of ThreadGroup.uncaughtException.
ThreadX
public ThreadX()
ThreadX
public ThreadX(Runnable target)
ThreadX
public ThreadX(Runnable target,
String name)
ThreadX
public ThreadX(ThreadGroup threadGroup,
Runnable target,
String name)
tryJoin
public boolean tryJoin()
- Same as join(), but returns normally if interrupted.
- Returns:
- true if the wait ended normally; false if an InterruptedException occured
tryJoin
public boolean tryJoin(long milliseconds)
- Same as join(milliseconds), but returns normally if interrupted.
- Returns:
- true if the wait ended normally; false if an InterruptedException occured
trySleep
public static boolean trySleep(long milliseconds)
- Same as sleep(milliseconds), but an interruption merely cuts short the sleep.