[concurrency-interest] Atomicity of clearing of WeakReferences

Karnok Dávid 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?

 

-------------------------------- 

Karnok Dávid 

Research Assistant 

Engineering and Management Intelligence laboratory, Computer and Automation
Research Institute, Hungarian Academy of Sciences

 <http://www.sztaki.hu> http://www.sztaki.hu 

 <http://www.emi.sztaki.hu> http://www.emi.sztaki.hu

 

From: crazyboblee at gmail.com [mailto:crazyboblee at gmail.com] On Behalf Of Bob
Lee
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.

Bob 

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


More information about the Concurrency-interest mailing list