pg.ddx.io  pgsql-jdbc@postgresql.org mailing list archive  
help / color / mirror / Atom feed
Race condition in org.postgresql.jdbc1.AbstractJdbc1Statement?
2+ messages / 1 participants
[nested] [flat]

* Race condition in org.postgresql.jdbc1.AbstractJdbc1Statement?
@ 2004-08-26 17:27  jao@geophile.com
  0 siblings, 1 reply; 2+ messages in thread

From: jao@geophile.com @ 2004-08-26 17:27 UTC (permalink / raw)
  To: 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.



^ permalink  raw  reply  [nested|flat] 2+ messages in thread

* Re: Race condition in org.postgresql.jdbc1.AbstractJdbc1Statement?
@ 2004-08-26 18:31  jao@geophile.com
  parent: jao@geophile.com
  0 siblings, 0 replies; 2+ messages in thread

From: jao@geophile.com @ 2004-08-26 18:31 UTC (permalink / raw)
  To: pg@fastcrypt.com; +Cc: pgsql-jdbc

Quoting Dave Cramer <pg@fastcrypt.com>:

> This code has been removed from the current CVS head.
> 
> Which version of the code are you looking at ?

Oops, sorry, it's 7.4.1.

Jack Orenstein


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



^ permalink  raw  reply  [nested|flat] 2+ messages in thread


end of thread, other threads:[~2004-08-26 18:31 UTC | newest]

Thread overview: 2+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2004-08-26 17:27 Race condition in org.postgresql.jdbc1.AbstractJdbc1Statement? jao@geophile.com
2004-08-26 18:31 ` jao@geophile.com

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