How to get List of Java Threads



Αξιολόγηση Χρήστη:  / 2
ΧειρότεροΚαλύτερο 
Λεπτομέρειες

The following code returns a list of Java Threads :

View source
package ListThreads;
 
import java.util.Set;
 
public class ListOfThreads {
 
    /**
     * @param args the command line arguments
     */
    public static void main(String[] args) {
        Set threadSet = Thread.getAllStackTraces().keySet();
         Thread[] threadArray = threadSet.toArray(new Thread[threadSet.size()]);
         for(int i=0;i
             System.out.println(threadArray[i].getName().toString());
         }
    }
}
 


You have no rights to post comments

   
   

     

© Developerpages