Skip site navigation (1) Skip section navigation (2)

Re: non-trivial finalize() on AbstractJdbc2Statement

From: "Kevin Grittner" <Kevin(dot)Grittner(at)wicourts(dot)gov>
To: "Imran" <imranbohoran(at)gmail(dot)com>, ******* ******** <tivv00(at)gmail(dot)com>
Cc: "Dave Cramer" <pg(at)fastcrypt(dot)com>,<pgsql-jdbc(at)postgresql(dot)org>
Subject: Re: non-trivial finalize() on AbstractJdbc2Statement
Date: 2012-02-13 16:49:41
Message-ID: 4F38EAC5020000250004545C@gw.wicourts.gov (view raw or flat)
Thread:
Lists: pgsql-jdbc
******* ********<tivv00(at)gmail(dot)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: finalizer-v1.diff
Description: application/octet-stream (1.6 KB)

In response to

Responses

pgsql-jdbc by date

Next:From: Bodor AndrásDate: 2012-02-13 17:03:44
Subject: Re: bug on to do list reproducable at version 9.0-801
Previous:From: Віталій ТимчишинDate: 2012-02-13 15:23:10
Subject: Re: non-trivial finalize() on AbstractJdbc2Statement

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group