🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: borland.public.jbuilder.java.swing
Article #12671

Re: JInternalFrame : finalize method - PLEASE HELP !!!!

#12671
From: dwyatt
Date: Thu, 19 Nov 1998 00:00
29 lines
1613 bytes
On Thu, 19 Nov 1998 19:09:38 +0100, Nadia Akrour <akrour@spring.fr>
wrote:

>Hi,
>I have a JInternalFrame and I have implemented the finalize() method.The
>problem is that the method seems not to be called. Have anyone some
>experience of this ???
>The JInternalFrame has just a JPanel in it. Is there something else to
>do to free a JInternalFrame.
>Any help would be very appreciated !!
>Thanks in advance.
>Nadia.
>

The finalize() method is not normally guarranteed to be called.  There
is a class method provided (under the System(?) class) called
runFinalizersOnExit() that will make sure all finalizers are called.

However, this method has been deprecated ( or was as of 1.2beta4 ).

My suggestion is to provide a close() method of some type in your
subclass of JInternalFrame & call that.  I would also use the
finalize() method to make sure that the close() method had been
called, and signal an error if it has not been.  This will have the
effect of having the finalize() method do a check on the use of the
object; which can effectively tell you if resources are getting closed
even if it's not always invoked.

--Doug
Technical Details
Message-ID: <36549fec.10243010@forums.inprise.com>
Path: arc1-ca.pugleaf.net!unknown!not-for-mail
References: <36545EE1.8257D5FF@spring.fr>

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: 111d45,94fd7b1bf8ac8733
X-Google-Attributes: gid111d45,public
From: dwyatt@innocent.com
Subject: Re: JInternalFrame : finalize method - PLEASE HELP !!!!
Date: 1998/11/19
Message-ID: <36549fec.10243010@forums.inprise.com>
X-Deja-AN: 413665695
References: <36545EE1.8257D5FF@spring.fr>
Organization: Another Netscape Collabra Server User
Newsgroups: borland.public.jbuilder.java.swing