[concurrency-interest] Atomicity of clearing of WeakReferences

Bob Lee crazybob at crazybob.org
Wed Jul 15 02:24:12 EDT 2009

On Wed, Jul 15, 2009 at 1:14 AM, Karnok Dávid <karnok at sztaki.hu> wrote:

>  I would say, if a weak reference is immutable, then there should be only
> one instance around each individual contained object and the JVM should
> automagically return that on a new WeakReference(obj) call. I guess a
> factory pattern would have helped here more, e.g.
> WeakReference.to(myObject). What do you think?
You can extend WeakReference, so that won't work.

You could add a level of indirection to the referent, but I don't know of
any impls that do this.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://cs.oswego.edu/pipermail/concurrency-interest/attachments/20090715/2c58991b/attachment-0001.html>

More information about the Concurrency-interest mailing list