[concurrency-interest] Impossible Exception?

Thomas Hawtin Thomas.Hawtin at Sun.COM
Mon Jan 14 10:25:00 EST 2008


Kevin Condon wrote:
> 
> Isn't the statement "constructing = false;" missing after
> createObject() is invoked?  All get() calls after the first one will
> throw the exception.

No, the test "obj == null" should be false after a successful 
initialisation and therefore "constructing" will not be read.

Tom Hawtin

> On Jan 13, 2008 8:44 PM,  <concurrency-interest-request at cs.oswego.edu> wrote:
>> ---------- Forwarded message ----------
>> From: "Sam Berlin" <sberlin at gmail.com>
>> [...]
>>         if(obj == null) {
>>             if(constructing)
>>                 throw new IllegalStateException("constructing again!");
>>             constructing = true;
>>             obj = createObject();
>>         }


More information about the Concurrency-interest mailing list