Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

com.eireneh.util
Class ThreadUtil  view ThreadUtil download ThreadUtil.java

java.lang.Object
  extended bycom.eireneh.util.ThreadUtil

public class ThreadUtil
extends java.lang.Object

Various utilities for examining the running Threads and controlling their execution.
Distribution Licence:
Project B is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License, version 2 as published by the Free Software Foundation.
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
The License is available on the internet here, by writing to Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA, Or locally at the Licence link below.
The copyright to this program is held by it's authors.

Version:
D9.I8.T3

Constructor Summary
ThreadUtil()
           
 
Method Summary
private static void addItem(java.util.Vector vec, int depth, java.lang.String item)
          Private, used by getListing.
static java.lang.ThreadGroup findRoot()
          Find the root ThreadGroup by ascending the Thread tree
static java.lang.String[] getListing()
          Create a StringArray (mostly for debugging) detailing the current Threads, starting at the root ThreadGroup
static java.lang.String[] getListing(java.lang.ThreadGroup base)
          Create a StringArray (mostly for debugging) detailing the current Threads, starting at the specified ThreadGroup
static java.lang.Object invoke(java.lang.Object base, java.lang.String called_method_name, java.lang.Object[] called_params)
          Call a static method on a class given a sting
static java.lang.Object invoke(java.lang.String call, java.lang.Object[] called_params)
          Call a static method on a class given a sting
private static void listThread(java.util.Vector vec, int depth, java.lang.Thread thread)
          Private, used by getListing.
private static void listThreads(java.util.Vector vec, int depth, java.lang.ThreadGroup group)
          Private, used by getListing.
static void soundSleep(long millis)
          Sleep and don't think about throwing.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ThreadUtil

public ThreadUtil()
Method Detail

invoke

public static java.lang.Object invoke(java.lang.Object base,
                                      java.lang.String called_method_name,
                                      java.lang.Object[] called_params)
                               throws java.lang.ClassNotFoundException,
                                      java.lang.NoSuchMethodException,
                                      java.lang.IllegalAccessException,
                                      java.lang.reflect.InvocationTargetException
Call a static method on a class given a sting


invoke

public static java.lang.Object invoke(java.lang.String call,
                                      java.lang.Object[] called_params)
                               throws java.lang.ClassNotFoundException,
                                      java.lang.NoSuchMethodException,
                                      java.lang.IllegalAccessException,
                                      java.lang.reflect.InvocationTargetException
Call a static method on a class given a sting


soundSleep

public static void soundSleep(long millis)
Sleep and don't think about throwing. Mostly when a thread calls sleep you need to wrap it in a special try-catch block to get hold of the InterruptedException - which is rarely called and mostly ignored. This code takes care of the ignoring, and simply logs some stuff if InterruptedException do happen.


findRoot

public static java.lang.ThreadGroup findRoot()
Find the root ThreadGroup by ascending the Thread tree


getListing

public static java.lang.String[] getListing()
Create a StringArray (mostly for debugging) detailing the current Threads, starting at the root ThreadGroup


getListing

public static java.lang.String[] getListing(java.lang.ThreadGroup base)
Create a StringArray (mostly for debugging) detailing the current Threads, starting at the specified ThreadGroup


listThreads

private static void listThreads(java.util.Vector vec,
                                int depth,
                                java.lang.ThreadGroup group)
Private, used by getListing. Adds to a Vector the sub-threads


listThread

private static void listThread(java.util.Vector vec,
                               int depth,
                               java.lang.Thread thread)
Private, used by getListing. Adds to a Vector the sub-threads


addItem

private static void addItem(java.util.Vector vec,
                            int depth,
                            java.lang.String item)
Private, used by getListing. Adds to a Vector the sub-threads