On May 3, 2015, at 3:34 AM, KARR, DAVID <[email protected]> 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
