[concurrency-interest] Parametric Initialization On Demand Holder Idiom ?
joe.bowbeer at gmail.com
Fri Aug 31 02:18:07 EDT 2007
On 8/30/07, Hanson Char <hanson.char at gmail.com> wrote:
> On 8/30/07, Joe Bowbeer <joe.bowbeer at gmail.com> wrote:
> > This is OK for super-safe values like String. Immutable objects with
> > all fields final do not require safe publication. In general,
> > thread-safe values do require safe publication.
> Agree. However, is it possible to contrive an example where a
> thread-safe (but not super-safe like immutable) value passed to the
> SomethingMore.getInstance(params) would cause a
> surprising/unexpected/corrupted/partially-initialized result ?
Now I think this is a safe construction. The key is that
SomethingMore.value is final.
private final Object value;
More information about the Concurrency-interest