[concurrency-interest] Static initializer
dcholmes at optusnet.com.au
Tue Apr 10 23:10:46 EDT 2007
There is no need to make the static instance field final for
visibility/safety reasons, but if its really immutable then make it final.
If you intended instance to be mutable then you'd have a different problem
From: concurrency-interest-bounces at cs.oswego.edu
[mailto:concurrency-interest-bounces at cs.oswego.edu]On Behalf Of Dhanji R.
Sent: Wednesday, 11 April 2007 12:46 PM
To: Hanson Char
Cc: concurrency-interest at cs.oswego.edu
Subject: Re: [concurrency-interest] Static initializer
On 4/11/07, Hanson Char <hanson.char at gmail.com> wrote:
I would make the static "instance" field final as well in this case.
How would this help the thread safety? It also alters the semantics of the
instance (say you wanted to replace it later on) does it not?
The static initializer is sufficiently safe in this case for races to
getInstance() -- correct me if Im wrong?
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Concurrency-interest