Re: patch: tiny patch to correct stringbuffer size estimate - Mailing list pgsql-jdbc

From Oliver Jowett
Subject Re: patch: tiny patch to correct stringbuffer size estimate
Date
Msg-id 20030722142807.GH11354@opencloud.com
Whole thread Raw
In response to Re: patch: tiny patch to correct stringbuffer size estimate  (Felipe Schnack <felipes@ritterdosreis.br>)
Responses Re: patch: tiny patch to correct stringbuffer size estimate
List 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

pgsql-jdbc by date:

Previous
From: Dmitry Tkach
Date:
Subject: Re: the IN clause saga
Next
From: Dmitry Tkach
Date:
Subject: Re: Detecting 'socket errors' - closing the Connection object