threads+CNI+SIGINT

Jeff Sturm jsturm@sigma6.com
Mon Mar 27 08:52:00 GMT 2000


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


More information about the Java mailing list