java.lang.ThreadGroup

public final void destroy():

Destroys this thread group and all of its subgroups. This thread group must be empty, indicating that all threads that had been in this thread group have since stopped.

First, the checkAccess method of this thread group is called with no arguments; this may result in a security exception.

public int activeGroupCount():

Returns an estimate of the number of active groups in this thread group and its subgroups. Recursively iterates over all subgroups in this thread group.

The value returned is only an estimate because the number of thread groups may change dynamically while this method traverses internal data structures. This method is intended primarily for debugging and monitoring purposes.

public final void checkAccess():

Determines if the currently running thread has permission to modify this thread group.

If there is a security manager, its checkAccess method is called with this thread group as its argument. This may result in throwing a SecurityException.

public final void setMaxPriority(int pri):

Sets the maximum priority of the group. Threads in the thread group that already have a higher priority are not affected.

First, the checkAccess method of this thread group is called with no arguments; this may result in a security exception.

If the pri argument is less than Thread.MIN_PRIORITY or greater than Thread.MAX_PRIORITY, the maximum priority of the group remains unchanged.

Otherwise, the priority of this ThreadGroup object is set to the smaller of the specified pri and the maximum permitted priority of the parent of this thread group. (If this thread group is the system thread group, which has no parent, then its maximum priority is simply set to pri.) Then this method is called recursively, with pri as its argument, for every thread group that belongs to this thread group.

 

 

 

發佈了44 篇原創文章 · 獲贊 15 · 訪問量 6萬+
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章