Introduced:
In the previous article we discussed the threading action of the agent using the environment pointer to access the VM, which discusses the thread group operations.
Category 3: Thread Group operations
A.gettopthreadgroups. Let the agent get all the global thread groups in the VM.
Jvmtierrorgettopthreadgroups (jvmtienv* env, jint* group_count_ptr, jthreadgroup** groups_ptr)
The function returns the number of global thread groups and the list of thread groups.
B.getthreadgroupinfo. Gets the information for a thread group.
typedef struct {Jthreadgroup parent; char* name; Jint max_priority; Jboolean Is_daemon;} Jvmtithreadgroupinfo;
Jvmtierrorgetthreadgroupinfo (jvmtienv* env, Jthreadgroup Group, jvmtithreadgroupinfo* info_ptr)
As can be seen from here, it will contain information such as the thread group's father, the thread group name (UTF-8 format), the maximum priority, whether the daemon thread group, and so on.
C.getthreadgroupchildren. Gets the children of a specified thread group.
Jvmtierrorgetthreadgroupchildren (jvmtienv* env, Jthreadgroup Group, jint* Thread_count_ptr, jthread** threads_ptr, jint* group_count_ptr, jthreadgroup** groups_ptr)
Because the relationship of thread groups and threads also adheres to the composite design pattern in designing patterns. So a child of a thread group can be a child thread group, or it can be some live child thread. So here you can see that it returns the number of child threads, the list of child threads, the number of child thread groups, and the list of child thread groups.
This article is from the "cohesion of parallel Lines" blog, please be sure to keep this source http://supercharles888.blog.51cto.com/609344/1587695
JPDA Architecture Research 7-agent using environment pointers to access VMS (thread Group Management chapter)