View the JVM thread name

  • Example shows

  In the Java Virtual Machine (JVM); In addition to user-created thread, there are other threads to service users thread. They were assigned to different groups according to different uses to manage. This example will demonstrate where the group name and the names of the threads in the JVM.

  • Key Technology

  Thread Group (ThreadGroup) identifies a set of threads. In addition thread group may also include other thread groups. Thread group consisting of a tree in which, in addition to the initial set of threads, each thread group has a parent thread group. Allow threads to access information about its own thread group. But it does not allow access to information the parent group or other groups of related threads thread group. ThreadGroup commonly used method is as follows:

ThreadGroup common method
Method name effect
activeCount()  
activeGroupCount()  
anumerate(Thread[] list,boolean recurse) Copy the thread in all activities of the group into the specified array
anumerate(ThreadGroup[] list,boolean recurse)  
getName()  
getParent()  

Guess you like

Origin www.cnblogs.com/cglib/p/11131607.html