web_backend_develope
parent
81308525b7
commit
95c439a114
@ -1,12 +1,29 @@
|
||||
package com.platform.test;
|
||||
|
||||
import com.platform.utils.ThreadVolume;
|
||||
|
||||
|
||||
public class testThread {
|
||||
|
||||
public static void main(String[] args) {
|
||||
MyTestThread thj = new MyTestThread();
|
||||
thj.start();
|
||||
System.err.println(thj.isDaemon());
|
||||
Thread th = new Thread(thj,"test1");
|
||||
th.setDaemon(true);
|
||||
th.start();
|
||||
System.err.println(th.isDaemon());
|
||||
ThreadGroup group = Thread.currentThread().getThreadGroup();
|
||||
System.err.println(group.getName());
|
||||
int size = group.activeCount();
|
||||
Thread[] slackList = new Thread[size];
|
||||
|
||||
/* 获取根线程组的所有线程 */
|
||||
int actualSize = group.enumerate( slackList );
|
||||
|
||||
Thread[] list = new Thread[actualSize];
|
||||
System.arraycopy( slackList, 0, list, 0, actualSize );
|
||||
for (Thread thread : list) {
|
||||
System.err.println(thread.getName());
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
Loading…
Reference in new issue