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
Views: Raw Message | Whole Thread | Download mbox | Resend email
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 Content-Type Size
finalizer-v1.diff application/octet-stream 1.6 KB

In response to

Responses

Browse pgsql-jdbc by date

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