pg.ddx.io  pgsql-jdbc@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: jao@geophile.com
To: pgsql-jdbc@postgresql.org
Subject: Race condition in org.postgresql.jdbc1.AbstractJdbc1Statement?
Date: Thu, 26 Aug 2004 13:27:38 -0400
Message-ID: <1093541258.412e1d8ae5989@geophile.com> (raw)

Cursor and statement names include the value of m_preparedCount:

    m_statementName = "JDBC_STATEMENT_" + m_preparedCount++;

and

    m_cursorName = "JDBC_CURS_" + m_preparedCount++;

m_preparedCount is static, and it looks like m_preparedCount++ should
be synchronized:

    // m_preparedCount is used for naming of auto-cursors and must
    // be synchronized so that multiple threads using the same
    // connection don't stomp over each others cursors.
    private static int m_preparedCount = 1;
    private synchronized static int next_preparedCount()
    {
        return m_preparedCount++;
    }

But next_preparedCount() is not used.

Should the creation of statement and cursor names use next_preparedCount()
instead of using m_preparedCount directly?

Jack Orenstein


----------------------------------------------------------------
This message was sent using IMP, the Internet Messaging Program.



view thread (2+ messages)  latest in thread

Message-ID: <1093541258.412e1d8ae5989@geophile.com>
Permalink:  ../1093541258.412e1d8ae5989@geophile.com/
Also on:    postgresql.org/message-id/1093541258.412e1d8ae5989@geophile.com

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-jdbc@postgresql.org
  Cc: jao@geophile.com
  Subject: Re: Race condition in org.postgresql.jdbc1.AbstractJdbc1Statement?
  In-Reply-To: <1093541258.412e1d8ae5989@geophile.com>
  References: <1093541258.412e1d8ae5989@geophile.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox