geronimo-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Dain Sundstrom <d...@iq80.com>
Subject Re: How do swing apps work?
Date Sat, 09 Sep 2006 01:01:41 GMT
On Sep 8, 2006, at 5:24 PM, David Blevins wrote:

> On Sep 8, 2006, at 4:51 PM, David Jencks wrote:
>
>> I fiddled around a bit and got the daytrader streamer app client  
>> to work on trunk (except I might have broker the update timer).   
>> However, to do this I had to add code so the main method doesn't  
>> return until the app exits: otherwise it returns and our app  
>> client container shuts down the kernel.
>>
>> How do standalone swing apps work?  Do the main methods return  
>> more or less immediately or do they block somehow or get used  
>> somehow until the app is ready to close?
>>
>> If they return immediately can anyone suggest a way to detect that  
>> the app has exited so we can stop the kernel and exit the container?
>>
>> hoping someone somewhere has written a swing app :-)
>
> I have in a former life.  It's the same as server software -- when  
> there are nothing but daemon threads left, you exit.  Some people  
> keep the main method alive (as that thread is not a daemon  
> thread).  Some people launch off another non-daemon thread and let  
> main return.
>
> I know I'm telling you things you already know, so I guess my  
> question is what's wrong with using the finalize method to stop the  
> kernel and exit the container?

Finalizers are evil.  They can easily be replaced by a  
PhantomReference or a shutdown hook.

-dain

Mime
View raw message