@Immutable public class ThreadGroups extends Object
ThreadGroup
s.Modifier and Type | Method and Description |
---|---|
static ThreadGroup |
getServerThreadGroup()
Determines a suitable thread group for server threads which
provide shared services for one or more otherwise unrelated
client threads.
|
static ThreadGroup |
getThreadGroup()
Returns the thread group of the
security manager if installed or
else the thread group of the current thread. |
public static ThreadGroup getServerThreadGroup()
When a server thread gets spawned from a client thread and no particular thread group is selected, then it gets inherited from the client thread to the server thread. However, this may be inappropriate if the server thread has a longer life time than the client thread or if it's shared by other client threads in different thread groups. This method can then get used in order to determine a suitable thread group for the server thread.
This method searches for the top level accessible parent thread group by
calling getThreadGroup()
and walking up the parent thread group
hierarchy until the next parent does not exist or is inaccessible.
If there is a security manager installed, then this method typically
returns its directly associated thread group because this is the only
accessible one.
Otherwise, this method typically returns the root thread group.
public static ThreadGroup getThreadGroup()
security manager
if installed or
else the thread group of the current thread.security manager
if installed or
else the thread group of the current thread.Copyright © 2005–2018 Schlichtherle IT Services. All rights reserved.