Thread, ThreadGroup
| Modifier and Type | Class and Description |
|---|---|
| private static class | ThreadUtils.
Deprecated
Use a A predicate implementation which always returns true.
Predicate.
|
| public static class | ThreadUtils.
Deprecated
Use a Used internally, consider private.
Predicate.
|
| public static interface | ThreadUtils.
Deprecated
Use a A predicate for selecting thread groups.
Predicate.
|
| public static class | ThreadUtils.
Deprecated
Use a A predicate implementation which matches a thread id.
Predicate.
|
| public static interface | ThreadUtils.
Deprecated
Use a A predicate for selecting threads.
Predicate.
|
| Modifier and Type | Field and Description |
|---|---|
| public static final ThreadUtils. | ALWAYS_TRUE_PREDICATE
Deprecated
Use a Predicate which always returns true.
Predicate.
|
| Access | Constructor and Description |
|---|---|
| public | ThreadUtils()
Deprecated
TODO Make private in 4.0.
ThreadUtils instances should NOT be constructed in standard programming. |
| Modifier and Type | Method and Description |
|---|---|
| public static Thread | Returns: The thread with the specified id ornull if no such thread exists.The thread id. threadId)Finds the active thread with the specified id. |
| public static Thread | Returns: The threads which belongs to a thread group with the specified group name and the thread's id match the specified id.null is returned if
no such thread exists.The thread id. threadId, final String The thread group name. threadGroupName)Finds the active thread with the specified id if it belongs to a thread group with the specified group name. |
| public static Thread | Returns: The thread which belongs to a specified thread group and the thread's id match the specified id.null is returned if no such thread
exists.The thread id. threadId, final ThreadGroup The thread group. threadGroup)Finds the active thread with the specified id if it belongs to the specified thread group. |
| public static Collection | Returns: An unmodifiableCollection of active thread groups matching the given predicate.the predicate. predicate)Finds all active thread groups which match the given predicate. |
| public static Collection | Returns: An unmodifiableCollection of active thread groups which match the given predicate and which is a subgroup of the given thread group.the thread group. threadGroup, final boolean if recurse, final Predicate<ThreadGroup> true then evaluate the predicate recursively on all thread groups in all subgroups of the given group.the predicate. predicate)Finds all active thread groups which match the given predicate and which is a subgroup of the given thread group (or one of its subgroups). |
| public static Collection | Returns: An unmodifiableCollection of active thread groups which match the given predicate and which is a subgroup of the given thread group.the thread group. threadGroup, final boolean if recurse, final ThreadUtils.true then evaluate the predicate recursively on all thread groups in all subgroups of the given group.the predicate. predicate
Deprecated
Use
findThreadGroups(ThreadGroup, boolean, Predicate).
Finds all active thread groups which match the given predicate and which is a subgroup of the given thread group (or one of its subgroups). |
| public static Collection | Returns: An unmodifiableCollection of active thread groups matching the given predicate.the predicate. predicate
Deprecated
Use
findThreadGroups(Predicate).
Finds all active thread groups which match the given predicate. |
| public static Collection | Returns: the thread groups with the specified group name or an empty collection if no such thread group exists. The collection returned is always unmodifiable.The thread group name. threadGroupName)Finds active thread groups with the specified group name. |
| public static Collection | Returns: An unmodifiableCollection of active threads matching the given predicate.the predicate. predicate)Finds all active threads which match the given predicate. |
| public static Collection | Returns: An unmodifiableCollection of active threads which match the given predicate and which belongs to the given thread group.the thread group. threadGroup, final boolean if recurse, final Predicate<Thread> true then evaluate the predicate recursively on all threads in all subgroups of the given group.the predicate. predicate)Finds all active threads which match the given predicate and which belongs to the given thread group (or one of its subgroups). |
| public static Collection | Returns: An unmodifiableCollection of active threads which match the given predicate and which belongs to the given thread group.the thread group. threadGroup, final boolean if recurse, final ThreadUtils.true then evaluate the predicate recursively on all threads in all subgroups of the given group.the predicate. predicate
Deprecated
Use
findThreads(ThreadGroup, boolean, Predicate).
Finds all active threads which match the given predicate and which belongs to the given thread group (or one of its subgroups). |
| public static Collection | Returns: An unmodifiableCollection of active threads matching the given predicate.the predicate. predicate
Deprecated
Use
findThreads(Predicate).
Finds all active threads which match the given predicate. |
| public static Collection | Returns: The threads with the specified name or an empty collection if no such thread exists. The collection returned is always unmodifiable.The thread name. threadName)Finds active threads with the specified name. |
| public static Collection | Returns: The threads which belongs to a thread group with the specified group name and the thread's name match the specified name, An empty collection is returned if no such thread exists. The collection returned is always unmodifiable.The thread name. threadName, final String The thread group name. threadGroupName)Finds active threads with the specified name if they belong to a thread group with the specified group name. |
| public static Collection | Returns: The threads which belongs to a thread group and the thread's name match the specified name, An empty collection is returned if no such thread exists. The collection returned is always unmodifiable.The thread name. threadName, final ThreadGroup The thread group. threadGroup)Finds active threads with the specified name if they belong to a specified thread group. |
| public static Collection | Returns: all thread groups excluding the system thread group. The collection returned is always unmodifiable.Gets all active thread groups excluding the system thread group (A thread group is active if it has been not destroyed). |
| public static Collection | Returns: all active threads. The collection returned is always unmodifiable.Gets all active threads (A thread is active if it has been started and has not yet died). |
| public static ThreadGroup | Returns: the system thread group.Gets the system thread group (sometimes also referred as "root thread group"). |
| public static void | |
| private static <T> Predicate | |
| private static Predicate | |
| private static Predicate | |
| public static void | |
| public static void | sleepQuietly(final Duration
the length of time to sleep. duration)Sleeps for the given duration while ignoring |
| ALWAYS_TRUE_PREDICATE | back to summary |
|---|---|
| public static final ThreadUtils. Deprecated Use a Predicate which always returns true. | |
| ThreadUtils | back to summary |
|---|---|
| public ThreadUtils()
Deprecated TODO Make private in 4.0. ThreadUtils instances should NOT be constructed in standard programming. Instead, the class should be used as This constructor is public to permit tools that require a JavaBean instance to operate.
| |
| findThreadById | back to summary |
|---|---|
| public static Thread findThreadById(final long threadId) Finds the active thread with the specified id.
| |
| findThreadById | back to summary |
|---|---|
| public static Thread findThreadById(final long threadId, final String threadGroupName) Finds the active thread with the specified id if it belongs to a thread group with the specified group name.
| |
| findThreadById | back to summary |
|---|---|
| public static Thread findThreadById(final long threadId, final ThreadGroup threadGroup) Finds the active thread with the specified id if it belongs to the specified thread group.
| |
| findThreadGroups | back to summary |
|---|---|
| public static Collection Finds all active thread groups which match the given predicate.
| |
| findThreadGroups | back to summary |
|---|---|
| public static Collection Finds all active thread groups which match the given predicate and which is a subgroup of the given thread group (or one of its subgroups).
| |
| findThreadGroups | back to summary |
|---|---|
| public static Collection Deprecated Finds all active thread groups which match the given predicate and which is a subgroup of the given thread group (or one of its subgroups).
| |
| findThreadGroups | back to summary |
|---|---|
| public static Collection Deprecated Finds all active thread groups which match the given predicate.
| |
| findThreadGroupsByName | back to summary |
|---|---|
| public static Collection Finds active thread groups with the specified group name.
| |
| findThreads | back to summary |
|---|---|
| public static Collection Finds all active threads which match the given predicate.
| |
| findThreads | back to summary |
|---|---|
| public static Collection Finds all active threads which match the given predicate and which belongs to the given thread group (or one of its subgroups).
| |
| findThreads | back to summary |
|---|---|
| public static Collection Deprecated Finds all active threads which match the given predicate and which belongs to the given thread group (or one of its subgroups).
| |
| findThreads | back to summary |
|---|---|
| public static Collection Deprecated Finds all active threads which match the given predicate.
| |
| findThreadsByName | back to summary |
|---|---|
| public static Collection Finds active threads with the specified name.
| |
| findThreadsByName | back to summary |
|---|---|
| public static Collection Finds active threads with the specified name if they belong to a thread group with the specified group name.
| |
| findThreadsByName | back to summary |
|---|---|
| public static Collection Finds active threads with the specified name if they belong to a specified thread group.
| |
| getAllThreadGroups | back to summary |
|---|---|
| public static Collection Gets all active thread groups excluding the system thread group (A thread group is active if it has been not destroyed).
| |
| getAllThreads | back to summary |
|---|---|
| public static Collection Gets all active threads (A thread is active if it has been started and has not yet died).
| |
| getSystemThreadGroup | back to summary |
|---|---|
| public static ThreadGroup getSystemThreadGroup() Gets the system thread group (sometimes also referred as "root thread group"). This method returns null if this thread has died (been stopped).
| |
| join | back to summary |
|---|---|
| public static void join(final Thread thread, final Duration duration) throws InterruptedException Waits for the given thread to die for the given duration. Implemented using
| |
| namePredicate | back to summary |
|---|---|
| private static <T> Predicate | |
| predicateThread | back to summary |
|---|---|
| private static Predicate | |
| predicateThreadGroup | back to summary |
|---|---|
| private static Predicate | |
| sleep | back to summary |
|---|---|
| public static void sleep(final Duration duration) throws InterruptedException Sleeps the current thread for the given duration. Implemented using
| |
| sleepQuietly | back to summary |
|---|---|
| public static void sleepQuietly(final Duration duration) Sleeps for the given duration while ignoring
The sleep duration may be shorter than duration if we catch a
| |
Deprecated
Use a Predicate.
| Access | Constructor and Description |
|---|---|
| private |
| Modifier and Type | Method and Description |
|---|---|
| public boolean | test(final Thread thread)
Implements org. Evaluates this predicate on the given thread. |
| public boolean | test(final ThreadGroup threadGroup)
Implements org. Evaluates this predicate on the given thread group. |
| AlwaysTruePredicate | back to summary |
|---|---|
| private AlwaysTruePredicate() | |
| test | back to summary |
|---|---|
| public boolean test(final Thread thread) Implements org. Doc from org. Evaluates this predicate on the given thread.
| |
| test | back to summary |
|---|---|
| public boolean test(final ThreadGroup threadGroup) Implements org. Doc from org. Evaluates this predicate on the given thread group.
| |
Deprecated
Use a Predicate.
A predicate implementation which matches a thread or thread group name.
| Access | Constructor and Description |
|---|---|
| public |
| Modifier and Type | Method and Description |
|---|---|
| public boolean | test(final Thread thread)
Implements org. Evaluates this predicate on the given thread. |
| public boolean | test(final ThreadGroup threadGroup)
Implements org. Evaluates this predicate on the given thread group. |
| name | back to summary |
|---|---|
| private final String name | |
| NamePredicate | back to summary |
|---|---|
| public NamePredicate(final String name) Constructs an instance.
| |
| test | back to summary |
|---|---|
| public boolean test(final Thread thread) Implements org. Doc from org. Evaluates this predicate on the given thread.
| |
| test | back to summary |
|---|---|
| public boolean test(final ThreadGroup threadGroup) Implements org. Doc from org. Evaluates this predicate on the given thread group.
| |
Deprecated
Use a Predicate.
| Modifier and Type | Method and Description |
|---|---|
| public boolean | Returns: true if the threadGroup matches the predicate, otherwise falsethe thread group threadGroup)Evaluates this predicate on the given thread group. |
| test | back to summary |
|---|---|
| public boolean test(ThreadGroup threadGroup) Evaluates this predicate on the given thread group.
| |
Deprecated
Use a Predicate.
| Modifier and Type | Field and Description |
|---|---|
| private final long |
| Access | Constructor and Description |
|---|---|
| public |
| Modifier and Type | Method and Description |
|---|---|
| public boolean | test(final Thread thread)
Implements org. Evaluates this predicate on the given thread. |
| threadId | back to summary |
|---|---|
| private final long threadId | |
| ThreadIdPredicate | back to summary |
|---|---|
| public ThreadIdPredicate(final long threadId) Predicate constructor
| |
| test | back to summary |
|---|---|
| public boolean test(final Thread thread) Implements org. Doc from org. Evaluates this predicate on the given thread.
| |
Deprecated
Use a Predicate.
| Modifier and Type | Method and Description |
|---|---|
| public boolean |
| test | back to summary |
|---|---|
| public boolean test(Thread thread) Evaluates this predicate on the given thread.
| |