From: Stephen C. <sco...@jo...> - 2013-07-12 09:28:14
|
You may be right, although neither volatile nor synchronized are appealing here. Please raise an issue on GitHub Stephen On 12 July 2013 10:19, Lin Wang <sup...@gm...> wrote: > The javadoc of ISODateTimeFormat class says it's thread-safe and immutable. > The static fields are lazily initialized. However it seems it's not done in > a thread-safe manner. > > For example, dt is lazily initialized in > public static DateTimeFormatter dateTime() { > if (dt == null) { > dt = new DateTimeFormatterBuilder() > .append(date()) > .append(tTime()) > .toFormatter(); > } > return dt; > } > > When there are two threads both inside this method, is it possible that one > thread sees an unsafely published non-null dt value due to cache > incoherence? > > Did I miss something? > > ------------------------------------------------------------------------------ > See everything from the browser to the database with AppDynamics > Get end-to-end visibility with application monitoring from AppDynamics > Isolate bottlenecks and diagnose root cause in seconds. > Start your free trial of AppDynamics Pro today! > http://pubads.g.doubleclick.net/gampad/clk?id=48808831&iu=/4140/ostg.clktrk > _______________________________________________ > Joda-interest mailing list > Jod...@li... > https://lists.sourceforge.net/lists/listinfo/joda-interest > |