EXECUTION
Virtual Machine Exit
12.9
12.7 Finalization of Classes
If a class declares a class method
classFinalize
that takes no arguments and
returns no result:
static void classFinalize() throws Throwable {
. . .
}
then this method will be invoked before the class is unloaded ( 12.8). Like the
finalize
method for objects, this method will be automatically invoked only
once. This method may optionally be declared
private
,
protected
, or
public
.
12.8 Unloading of Classes and Interfaces
A Java Virtual Machine may provide mechanisms whereby classes are
unloaded
.
The details of such mechanisms are not specified in this version of the Java Lan
guage Specification. In general, groups of related class and interface types will be
unloaded together. This can be used, for example, to unload a group of related
types that have been loaded using a particular class loader. Such a group might
consist of all the classes implementing a single applet in a Java based browser
such as HotJava, for example.
A class may not be unloaded while any instance of it is still reachable ( 12.6).
A class or interface may not be unloaded while the
Class
object that represents it
is still reachable.
Classes that declare class finalizers ( 12.7) will have these finalizers run
before they are unloaded.
12.9 Virtual Machine Exit
A Java Virtual Machine terminates all its activity and
exits
when one of two things
happens:
All the threads that are not daemon threads ( 20.20.24) terminate.
Some thread invokes the
exit
method ( 20.16.2) of class
Runtime
or class
System
and the exit operation is not forbidden by the security manager
( 20.17.13).
A Java program can specify that the finalizers of all objects that have finalizers,
and all classes that have class finalizers, that have not yet been automatically
invoked are to be run before the virtual machine exits. This is done by invoking
the method
runFinalizersOnExit
of class
System
with the argument
true
. The
235
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