Race condition in org.postgresql.jdbc1.AbstractJdbc1Statement?

From: jao(at)geophile(dot)com
To: pgsql-jdbc(at)postgresql(dot)org
Subject: Race condition in org.postgresql.jdbc1.AbstractJdbc1Statement?
Date: 2004-08-26 17:27:38
Message-ID: 1093541258.412e1d8ae5989@geophile.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-jdbc

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.

Responses

Browse pgsql-jdbc by date

  From Date Subject
Next Message Dave Cramer 2004-08-26 18:09:54 Re: Race condition in
Previous Message Kris Jurka 2004-08-24 15:16:24 Re: JDBC