Java Dump Stream dumpThreads(PrintStream ps)

Here you can find the source of dumpThreads(PrintStream ps)

Description

dump Threads

License

Open Source License

Declaration

public static void dumpThreads(PrintStream ps) 

Method Source Code


//package com.java2s;
/*/*  w w  w  . ja va  2  s  .  c o m*/
 *  $URL$
 *  $Revision$
 *  $Author$
 *  $Date$
 *  
 *  $Copyright-Start$
 *
 *  Copyright (c) 2016
 *  Sam Corporation
 *  All Rights Reserved
 *
 *  This software is furnished under a corporate license for use on a
 *  single computer system and can be copied (with inclusion of the
 *  above copyright) only for use on such a system.
 *
 *  The information in this document is subject to change without notice
 *  and should not be construed as a commitment by Sam Corporation.
 *
 *  Sam Corporation assumes no responsibility for the use of the
 *  software described in this document on equipment which has not been
 *  supplied or approved by Sam Corporation.
 *
 *  $Copyright-End$
 */

import java.io.PrintStream;

public class Main {
    public static void dumpThreads(PrintStream ps) {
        int active = Thread.activeCount();
        Thread threads[] = new Thread[active];
        Thread.enumerate(threads);

        for (int i = 0; i < active; i++) {
            ps.println(i + ": " + threads[i]);
        }
    }
}

Related

  1. dumpStream(InputStream in, PrintStream dump, boolean closeIn)
  2. dumpStream(InputStream in, String file)
  3. dumpStreamAndReOffer(InputStream is)
  4. dumpStreamToFile(InputStream is, String filename)
  5. dumpStreamToStream(InputStream is, OutputStream os)
  6. dumpToFile(Object obj, OutputStream os)