🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: borland.public.jbuilder.java.api
Article #3433

runFinalizersOnExit() hangs my program when I exit()

#3433
From: Leo Breebaart
Date: Tue, 13 Jan 1998 00:00
39 lines
1925 bytes
Hi all,

If I create the simplest possible default JBuilder app in the IDE,
with a default menubar attached, and I then compile this
program and run it from the command-line using jbuilder\java\bin\java,
and I choose File|Exit, the program exits, and I am returned to
my command-line prompt.

With me so far?

If, however, I add 

    System.runFinalizersOnExit(true);

to my main(), exactly the same sequence of events (compile-run-exit)
causes the program to hang, and I can only get my prompt back with
a ctrl-C.

The program window does disappear, but testing shows that added 
finalize() methods are indeed never called. It's as if halfway through
System.exit(0) the VM simply stops dead in its tracks.

If the program does not do anything graphical, the finalizers
*are* correctly called, and the program exits normally. It is only
programs with windows that show the hanging behaviour.

Is this a JDK problem? A JCBL problem? A compilation problem?
Something stupid I'm overlooking (though I checked and this is
not in the FAQ)?

Any help or suggestions for a workaround will be most appreciated.

(And yes, in the final application I really do have to make sure
that the finalize() methods are called for all objects when the
program finishes...)

-- 
Leo Breebaart  <leo@lspace.org>
Technical Details
Message-ID: <34BB79E8.C105066A@lspace.org>
Path: arc1-ca.pugleaf.net!unknown!not-for-mail

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: f5619,23d0b465eda3bbde,start
X-Google-Attributes: gidf5619,public
X-Google-Thread: 1089d0,23d0b465eda3bbde,start
X-Google-Attributes: gid1089d0,public
From: Leo Breebaart <leo@lspace.org>
Subject: runFinalizersOnExit() hangs my program when I exit()
Date: 1998/01/13
Message-ID: <34BB79E8.C105066A@lspace.org>
X-Deja-AN: 315545354
Content-Transfer-Encoding: 7bit
Content-Type: text/plain; charset=us-ascii
Organization: L-Space
Mime-Version: 1.0
Newsgroups: borland.public.jbuilder.java.api,borland.public.jbuilder.jbcl