Re: Remove usage of finalizers ? - Mailing list pgsql-jdbc

From Heikki Linnakangas
Subject Re: Remove usage of finalizers ?
Date
Msg-id 526814C5.8060106@vmware.com
Whole thread Raw
In response to Re: Remove usage of finalizers ?  (Steven Schlansker <stevenschlansker@gmail.com>)
List pgsql-jdbc
On 23.10.2013 21:04, Steven Schlansker wrote:
>
> On Oct 23, 2013, at 10:58 AM, Adib Saikali<adib.saikali@gmail.com>  wrote:
>
>> Seems to me that PhantomReferences can solve this problem as they will provide the ability to the cleanup without
causingthe performance issues with the finalizers. I am not familiar with the postgres jdbc driver code base so I have
noidea how much work is involved in switching from finalizers to phantom references. 
>>
>> Can anyone with knowledge of the jdbc code base comment on the practicality of moving from finalizers to phantom
reference.
>
> Do we in fact know that phantom (or weak?) references are cheaper than Finalizers?

Well, we *already* use phantom references to clean up server-side
resources in the SimpleQuery and Portal classes. I think that's actually
already enough to avoid server-side resource leaks if an application
neglects to close Statements.

Rather than discussing what might be the best way to use finalizers or
phantom references to replace the current finalizer in the Statement
class, I wish someone would just try to remove it and see what happens.

- Heikki


pgsql-jdbc by date:

Previous
From: Steven Schlansker
Date:
Subject: Re: Remove usage of finalizers ?
Next
From: Vitalii Tymchyshyn
Date:
Subject: Re: Remove usage of finalizers ?