20.20
java.lang.Thread
THE PACKAGE JAVA.LANG
Threads.currentThread().getThreadGroup().allThreadsCount()
should be used. See the method
allThreadsCount
of class
ThreadGroup
.]
20.20.36
public static int enumerate(Thread tarray[])
The active threads in the thread group to which the current thread belongs, includ
ing threads in subgroups of that thread group, are enumerated and their Thread
objects are put into the array
tarray
. The number of threads actually put into the
array is returned. Call this value
n
; then the threads have been put into elements
0
through
n 1
of
tarray
. If the number of threads exceeds the length of
tarray
,
then some of the threads,
tarray.length
of them, are chosen arbitrarily and
used to fill the array
tarray
.
[This method is deprecated for use in new code after Java version 1.1 becomes
available. Instead, an expression equivalent to:
Threads.currentThread().getThreadGroup().allThreads()
should be used. See the method
allThreads
of class
ThreadGroup
.]
20.20.37
public static void dumpStack()
This is a utility method that makes it easy to print a stack dump for the current
thread. It is equivalent in effect to:
new Exception("Stack trace").printStackTrace()
See the
printStackTrace
method ( 20.22.6) of class
Throwable
.
20.20.38
public static void yield()
This method causes the current thread to yield, allowing the thread scheduler to
choose another runnable thread for execution.
20.20.39
public static void sleep(long millis)
throws InterruptedException
This method causes the current thread to yield and not to be scheduled for further
execution until a certain amount of real time has elapsed, more or less.
The amount of real time, measured in milliseconds, is given by
millis
.
If the current thread is interrupted ( 20.20.31) by another thread while it is
waiting, then the sleep is ended and an
InterruptedException
is thrown.
600
footer
Our partners:
PHP: Hypertext Preprocessor Best Web Hosting
Java Web Hosting
Inexpensive Web Hosting
Jsp Web Hosting
Cheapest Web Hosting
Jsp Hosting
Cheap Hosting
Visionwebhosting.net Business web hosting division of Web
Design Plus. All rights reserved