Re: Calling Connection.close() in Connection.finalize()

From: Matthias Brunner <mb(at)blumenstrasse(dot)vol(dot)at>
To: Barry Lind <barry(at)xythos(dot)com>
Cc: pgsql-jdbc(at)postgresql(dot)org
Subject: Re: Calling Connection.close() in Connection.finalize()
Date: 2002-08-15 17:56:55
Message-ID: 200208151956.55907.mb@blumenstrasse.vol.at
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-jdbc

On Thursday 15 August 2002 19:43, Barry Lind wrote:
> Matthias,
>
> That is the behavior I would expect. If you don't close the connection
> you will see this. The reason here is the JVM doesn't run finalization
> when it is exiting. So you didn't close the connection and the finalize
> method is never called because you are just exiting before garbage
> collection runs.
>

Thanks, you're right.
After executing "con=null;System.gc();" the database connection is closed
properly.
Dumb I was thinking of the finalize method as a C++-like destructor which must
always be called.
Again, thanks for your efforts.

Cheers!
--
Matthias Brunner <mb(at)blumenstrasse(dot)vol(dot)at>
PGP FP 7862 32B3 3B75 292A F76F 5042 8587 21AB 5B89 D501
Check out http://blumenstrasse.vol.at/~mb/gpgkey.asc

In response to

Browse pgsql-jdbc by date

  From Date Subject
Next Message Jun KAWAI 2002-08-15 18:09:46 Re: md5 authentication bug?
Previous Message Felipe Schnack 2002-08-15 17:48:38 datasource