Re: synchronized code [Viruschecked]

Поиск
Список
Период
Сортировка
От Felipe Schnack
Тема Re: synchronized code [Viruschecked]
Дата
Msg-id 1042053407.12254.124.camel@desenv1.ritterdosreis.br
обсуждение исходный текст
Ответ на Re: synchronized code [Viruschecked]  ("Patric Bechtel" <bechtel@ipcon.de>)
Список pgsql-jdbc
  Yes, good java programmers use lots of StringBuffers :-)
  But about Statement in threaded use: this is discouraged by the spec
or it isn't actually supported?

On Wed, 2003-01-08 at 17:04, Patric Bechtel wrote:
> On 08 Jan 2003 16:43:11 -0200, Felipe Schnack wrote:
>
> >  I'm quite worried with the amount of synch'd code in our jdbc driver
> >code, we all know this is a very costly operation in Java.
> >  As far as I could see from the sources, the sole objective of these
> >calls are to avoid two processes accessing the same shared StringBuffer
> >we use. The strangest thing, IMHO, is that every time we use this
> >buffer, we are calling setLength(0) or, in plain english, resetting this
> >buffer. Is just me the paranoid or this isn't helping performance at
> >all? As I understand java, object creating is a very cheap operation
> >these days (in the old days it was slow), but synch'ing is VERY
> >costly...
>
> There's no reason to fear about synchronisation since Hotspot anymore. The
> lock, as only one process is building it, is definitely less work
> than the work the garbage collector has to do in a mark-sweep cycle to
> get rid of Stringbuffer over Stringbuffer (which would occur otherwise).
> That said, as the syncing is upon a Stringbuffer for EACH statement, and
> the statement class threaded use is discouraged anyway, we will probably
> never see code really running into this.
> As many many string operations are needed throughout the driver, the use
> of a sync'ed stringbuffer whenever bigger string operations are made
> is very wise and good style. Kudos here to the developer who made this...
> The only drawback is, for the developers, that they have to be a bit
> cautious with the use of it, not to produce deadlocks; but that's
> rather easy, as each and every statement has it's own and the statement
> class itself isn't that big.
>
> just my 0.02¬...
>
>
>
> sincerely,
>
> Patric Bechtel
> IPCON Informationssysteme
>
>
>
> ---------------------------(end of broadcast)---------------------------
> TIP 2: you can get off all lists at once with the unregister command
>     (send "unregister YourEmailAddressHere" to majordomo@postgresql.org)
--

Felipe Schnack
Analista de Sistemas
felipes@ritterdosreis.br
Cel.: (51)91287530
Linux Counter #281893

Centro Universitário Ritter dos Reis
http://www.ritterdosreis.br
ritter@ritterdosreis.br
Fone/Fax.: (51)32303341


В списке pgsql-jdbc по дате отправления:

Предыдущее
От: "Patric Bechtel"
Дата:
Сообщение: Re: synchronized code [Viruschecked]
Следующее
От: Felipe Schnack
Дата:
Сообщение: Re: synchronized code