This is the mail archive of the
java-discuss@sourceware.cygnus.com
mailing list for the Java project.
Re: threads+CNI+SIGINT
- To: Cedric Berger <cedric at wireless-networks dot com>
- Subject: Re: threads+CNI+SIGINT
- From: Jeff Sturm <jsturm at sigma6 dot com>
- Date: Mon, 27 Mar 2000 11:56:32 -0500
- CC: Oskar Liljeblad <osk at hem dot passagen dot se>, "java-discuss at sourceware dot cygnus dot com" <java-discuss at sourceware dot cygnus dot com>
- Organization: AppNet
- References: <20000327175019.A10593@strix.eductussyd.se> <38DF89F9.C7333BD2@wireless-networks.com>
Cedric Berger wrote:
> Finalization must only be used for releasing resources like memory,
> syncronization objects, ... which means that its main use is for
> native methods.
No. It is better to release all resources explicitly. The
java.net.Socket class (for example) does have a close() method. Your
code should always try to invoke close() before releasing the object.
Finalization will probably eventually close it anyway, but it is poor
coding practice to rely on finalization that way.
--
Jeff Sturm
jsturm@sigma6.com