groovy-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jacopo Cappellato <jacopo.cappell...@gmail.com>
Subject Re: Thread safety and OptionBuilder
Date Sun, 03 May 2015 05:23:31 GMT

On May 3, 2015, at 3:34 AM, KARR, DAVID <dk068x@att.com> wrote:

> 
> Why exactly do you believe that synchronizing the static method is not enough to "make
the Groovy code thread safe" (ignoring the lack of specificity in that statement).
> 
> If OptionsBuilder is truly not thread-safe, if you can guarantee that this class is the
only one making use of OptionsBuilder in the application, and this static synchronized method
is the only method in the class using OptionsBuilder, then that seems like reasonable protection.

Hi David,

I am saying that synchronizing the static method is not enough because I don't see how we
can guarantee that this class is the only one making use of OptionBuilder for these reasons:
* the static method in the class is called by a public method in the same class
* other classes within the same JVM could use OptionsBuilder: OptionsBuilder is used by other
code in Groovy but it could also be used by Groovy scripts written by users

Regards,

Jacopo
Mime
View raw message