12.6.1
Implementing Finalization
EXECUTION
The
finalize
 method declared in class
Object
 takes no action. However, the
fact that class
Object
 declares a
finalize
 method means that the
finalize
method for any class can always invoke the
finalize
 method for its superclass,
which is usually good practice. (Unlike constructors, finalizers do not automati 
cally invoke the finalizer for the superclass; such an invocation must be coded
explicitly.)
For efficiency, an implementation may keep track of classes that do not over 
ride the
finalize
 method of class
Object
, or override it in a trivial way, such as:
protected void finalize() throws Throwable {
super.finalize();
}
We encourage implementations to treat such objects as having a finalizer that is
not overridden, and to finalize them more efficiently, as described in  12.6.1.
A finalizer may be invoked explicitly, just like any other method.
12.6.1   Implementing Finalization
Every object can be characterized by two attributes: it may be
reachable
,
finalizer 
reachable
, or
unreachable
, and it may also be
unfinalized
,
finalizable
, or
finalized
.
A
reachable
 object is any object that can be accessed in any potential continu 
ing computation from any live thread. Optimizing transformations of a program
can be designed that reduce the number of objects that are reachable to be less
than those which would naively be considered reachable. For example, a compiler
or code generator may choose, explicitly or implicitly, to set a variable or parame 
ter that will no longer be used to
null
 to cause the storage for such an object to be
potentially reclaimable sooner. A
finalizer reachable
 object can be reached from
some finalizable object through some chain of references, but not from any live
thread. An
unreachable
 object cannot be reached by either means.
An
unfinalized
 object has never had its finalizer automatically invoked; a
finalized
 object has had its finalizer automatically invoked. A
finalizable
 object
has never had its finalizer automatically invoked, but the Java Virtual Machine
may eventually automatically invoke its finalizer.
232






footer




 

 

 

 

 Home | About Us | Network | Services | Support | FAQ | Control Panel | Order Online | Sitemap | Contact

java hosting

 

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