THE PACKAGE JAVA.LANG
java.lang.Thread
20.20
Some thread invokes the
exit
method ( 20.16.2) of class
Runtime
(and the
security manager ( 20.17.13) approves execution of the
exit
operation); this
stops every thread being run by the Java Virtual Machine that is running the
thread that invokes the
exit
method.
As a thread dies, the
notifyAll
method ( 20.1.10) is invoked for the
Thread
object that represents it; this fact is important for the proper operation of the
join
methods ( 20.20.28, 20.20.29, 20.20.30). A thread is also removed from its
thread group as it dies. Once a thread has been stopped, it is no longer alive and it
cannot be restarted.
A thread that is alive can be
suspended
and
resumed
. A suspended thread is
considered to be alive, but it performs no work, makes no progress, executes no
virtual machine instructions. Resumption restores a thread to the state of active
execution. A thread is suspended when it or another thread calls the
suspend
method ( 20.20.17) of the
Thread
object that represents it (and the security man
ager ( 20.17.11) approves execution of the
suspend
operation). A thread is
resumed when another thread calls the
resume
method ( 20.20.18) of the
Thread
object that represents it (and the security manager ( 20.17.11) approves execution
of the
resume
operation).
Every thread has a
priority
. When there is competition for processing
resources, threads with higher priority are generally executed in preference to
threads with lower priority. Such preference is not, however, a guarantee that the
highest priority thread will always be running, and thread priorities cannot be used
to implement mutual exclusion. When code running in some thread creates a new
Thread
object, the newly created thread has its priority initially set equal to the
priority of the creating thread. But the priority of a thread
T
may be changed at
any time if some thread invokes the
setPriority
method of the
Thread
object
that represents
T
(and the security manager ( 20.17.11) approves execution of the
setPriority
operation).
Each thread may or may not be marked as a
daemon
. When code running in
some thread creates a new
Thread
object, the newly created thread is a daemon
thread if and only if the creating thread is a daemon. But the daemonhood of a
thread
T
may be changed before it is activated if some other thread invokes the
setDaemon
method of the
Thread
object that represents
T
(and the security man
ager ( 20.17.11) approves execution of the
setDaemon
operation).
589
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