On 09/02/2009, Dan Fabulich <d...@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-unsubscr...@commons.apache.org
>  For additional commands, e-mail: dev-h...@commons.apache.org
>
>

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

Reply via email to