commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sebb <seb...@gmail.com>
Subject Re: [dbutils] QueryRunner.fillStatement and the null problem (long)
Date Mon, 09 Feb 2009 23:18:44 GMT
On 09/02/2009, Dan Fabulich <dan@fabulich.com> wrote:
> Liam Coughlin wrote:
>
>
> > b) Yes it will have a thread safety issue -- you'll need to synchronize on
> > something when setting the pmdKnownBroken variable.
> >
>
>  When setting?  Or when reading?  Remember, once pmdKnownBroken is true, it
> will never again be false, so there's no risk that one thread will try to
> set it to true and another thread will try to set it to false.
>

There are two aspects to thread-safety - mutual exclusion and visibility.

Only the former appears to be addressed here.

The boolean could be made volatile to ensure visibility.

>  IMO the biggest risks here are:
>
>  1) Running getParameterType too many times (ideally we should only ever run
> it once on Oracle, but that may be too much to ask)
>
>  2) We overcompensate and create an unecessary synchronization bottleneck
>
>  What if I just make pmdKnownBroken "volatile"?
>
>
>  -Dan
>
> ---------------------------------------------------------------------
>  To unsubscribe, e-mail: dev-unsubscribe@commons.apache.org
>  For additional commands, e-mail: dev-help@commons.apache.org
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@commons.apache.org
For additional commands, e-mail: dev-help@commons.apache.org


Mime
View raw message