[concurrency-interest] Fences.keepAlive

Doug Lea dl at cs.oswego.edu
Mon Jan 19 06:15:06 EST 2009

Jeremy Manson wrote:
> Oh, right, we always meant to do that.  Good idea!
> I have two concerns with the javadoc:
> First, I think it might be unclear to the reader that the problem
> arises in that example, because nothing is seen to call the
> constructor. 

Can you (or anyone) think of a better short example?

> Second, I think it might be helpful to have a stronger statement of
> the problem in the Javadoc.  When I explain that this can happen to
> people, they are usually mystified and then shocked.  Something like
> "When a runtime can detect that no reference to an object will ever be
> stored in the heap, the garbage collector can reclaim that object at
> any time.  This can happen even if the object itself, of fields of
> that object, are still in use.  See Section 12.6.1 of the Java
> Language Specification for more details."  might be more complete.

Thanks! I added a light edit of this.


More information about the Concurrency-interest mailing list