[concurrency-interest] Atomicity of clearing of WeakReferences
karnok at sztaki.hu
Wed Jul 15 02:34:25 EDT 2009
Is there a reason the Reference sublcasses are not final? I think if there
are only limited number of reference types, why not have them individually
and have Reference<T> as a superinterface?
Engineering and Management Intelligence laboratory, Computer and Automation
Research Institute, Hungarian Academy of Sciences
From: crazyboblee at gmail.com [mailto:crazyboblee at gmail.com] On Behalf Of Bob
Sent: Wednesday, July 15, 2009 8:24 AM
To: Karnok Dávid
Cc: concurrency-interest at cs.oswego.edu
Subject: Re: [concurrency-interest] Atomicity of clearing of WeakReferences
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...
More information about the Concurrency-interest