[concurrency-interest] Impossible Exception?

Joe Bowbeer joe.bowbeer at gmail.com
Mon Jan 14 11:44:01 EST 2008


constructing could/should be reset if obj is not created:

  constructing = true;
  try {
    obj = createObject();
  } finally {
    if (obj != null)
      constructing = false;
  }

Though I suspect constructing was only added was to investigate this case of
the missing exception...

On Jan 14, 2008 7:25 AM, Thomas Hawtin <Thomas.Hawtin at sun.com> wrote:

> 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();
> >>         }
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: /pipermail/attachments/20080114/c3b1ebb2/attachment.html 


More information about the Concurrency-interest mailing list