Re: patch: tiny patch to correct stringbuffer size estimate

From: Oliver Jowett <oliver(at)opencloud(dot)com>
To: Felipe Schnack <felipes(at)ritterdosreis(dot)br>
Cc: pgsql-jdbc(at)postgresql(dot)org
Subject: Re: patch: tiny patch to correct stringbuffer size estimate
Date: 2003-07-22 14:28:07
Message-ID: 20030722142807.GH11354@opencloud.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-jdbc

On Tue, Jul 22, 2003 at 11:20:11AM -0300, Felipe Schnack wrote:

> These StringBuffer woes remember of an old request we made to this
> list... The last time I checked driver's sources, all acess to
> preparedstatement's stringbuffer are synchronized... this isn't
> necessary as jre's Stringbuffer already has all of its methods
> synchronized. The driver is still doing that? Just curious.

Yes, but to be threadsafe with a shared buffer you do need to synchronize as
the driver does a series of operations to accumulate a string that need to
be atomic. Synchronizing on each individual operation isn't enough.

That said, it's pretty silly to write code that depends on a Statement being
threadsafe :)

-O

In response to

Responses

Browse pgsql-jdbc by date

  From Date Subject
Next Message Dmitry Tkach 2003-07-22 14:30:09 Re: the IN clause saga
Previous Message Fernando Nasser 2003-07-22 14:27:26 Re: the IN clause saga