Re: non-trivial finalize() on AbstractJdbc2Statement - Mailing list pgsql-jdbc

From Kevin Grittner
Subject Re: non-trivial finalize() on AbstractJdbc2Statement
Date
Msg-id 4F38EAC5020000250004545C@gw.wicourts.gov
Whole thread Raw
In response to Re: non-trivial finalize() on AbstractJdbc2Statement  (Віталій Тимчишин <tivv00@gmail.com>)
Responses Re: non-trivial finalize() on AbstractJdbc2Statement  (Imran <imranbohoran@gmail.com>)
List pgsql-jdbc
******* ********<tivv00@gmail.com> wrote:
> Looking at the code... Can it be because
> org.postgresql.jdbc2.AbstractJdbc2Statement#isClosed is not
> volatile? There is no synchronization and finalizer thread may
> simply not see statement was just closed by another thread.

That sounds likely enough to me.  I don't know whether declaring the
flag volatile would be enough, but it needs either that or access
only through synchronized blocks.

In addition, I would recommend something like the attached to make
the code more bullet-proof.

-Kevin


Attachment

pgsql-jdbc by date:

Previous
From: Віталій Тимчишин
Date:
Subject: Re: non-trivial finalize() on AbstractJdbc2Statement
Next
From: Dave Cramer
Date:
Subject: Re: bug on to do list reproducable at version 9.0-801