|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcom.kuka.common.ThreadUtil
public final class ThreadUtil
Helper class for threads.
| Method Summary | |
|---|---|
static void |
dumpThreadGroup(OutputStream out,
ThreadGroup group)
Tries to dump all child threads and thread groups of the given ThreadGroup. |
static void |
dumpThreadGroup(Writer writer,
ThreadGroup group)
Tries to dump all child threads and thread groups of the given ThreadGroup. |
static List<ThreadGroup> |
getActiveThreadGroups(ThreadGroup group)
Returns the active thread groups in the given ThreadGroup. |
static List<Thread> |
getActiveThreads(ThreadGroup group,
boolean daemon)
Returns the active normal or daemon threads in the given ThreadGroup. |
static ThreadGroup |
getMainThreadGroup()
|
static int |
getThreadCount(ThreadGroup group,
boolean daemon)
Returns the number of active normal or daemon threads in the given ThreadGroup. |
static void |
milliSleep(long millis)
Helper method for sleeping some time. |
static void |
nanoSleep(long nanoSeconds)
Helper method for sleeping some time. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Method Detail |
|---|
public static void milliSleep(long millis)
Catches the interrupted exception, 'reinterrupts' the thread so that it's isInterrupted method returns true and
throws a ThreadInterruptedException.
Following calls of ThreadUtil.milliSleep() and ThreadUtil.nanoSleep() will return
immediately in case the interrupted exception has been thrown previously.
millis - The milliseconds to sleep. If negative or 0, the method returns immediately.
ThreadInterruptedException - if the sleep was interrupted.public static void nanoSleep(long nanoSeconds)
Catches the interrupted exception, 'reinterrupts' the thread so that it's isInterrupted method returns true and
throws a ThreadInterruptedException.
Following calls of ThreadUtil.milliSleep() and ThreadUtil.nanoSleep() will return
immediately in case the interrupted exception has been thrown previously.
nanoSeconds - The nanoseconds to sleep. If negative or 0, the method returns immediately.
ThreadInterruptedException - if the sleep was interrupted.
public static int getThreadCount(ThreadGroup group,
boolean daemon)
group - the thread groupdaemon - true, if the number of daemon threads
public static List<Thread> getActiveThreads(ThreadGroup group,
boolean daemon)
group - the thread groupdaemon - true if daemon threads
public static List<ThreadGroup> getActiveThreadGroups(ThreadGroup group)
group - the thread group
public static void dumpThreadGroup(OutputStream out,
ThreadGroup group)
ThreadGroup. This is not guaranteed to
print all threads, see the comment for ThreadGroup.enumerate(Thread[]).
out - An OutputStream, for example System.out. The default character encoding will be used.group - the thread group to dump
public static void dumpThreadGroup(Writer writer,
ThreadGroup group)
ThreadGroup. This is not guaranteed to
print all threads, see the comment for ThreadGroup.enumerate(Thread[]).
writer - A Writer, for example a StringWriter.group - the thread group to dumppublic static ThreadGroup getMainThreadGroup()
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||