Display information about a thread. - Java java.lang

Java examples for java.lang:Thread

Description

Display information about a thread.

Demo Code


//package com.java2s;
import java.io.PrintWriter;

public class Main {
    /**/* w w  w. j a  v a 2s  . co m*/
     * Display information about a thread.
     */
    private static void printThreadInfo(PrintWriter out, Thread t,
            String indent) {
        if (t == null) {
            return;
        }
        out.println(indent + "Thread: " + t.getName() + "  Priority: "
                + t.getPriority() + (t.isDaemon() ? " Daemon" : "")
                + (t.isAlive() ? "" : " Not Alive"));
    }
}

Related Tutorials