[concurrency-interest] AtomicReference and java.lang.ref package design thoughts

Oleksandr Otenko oleksandr.otenko at oracle.com
Mon Sep 1 09:11:45 EDT 2014

They are in separate packages and don't have any inheritance 
relationship exactly because they are in no way similar.


On 01/09/2014 05:48, DT wrote:
> Are any plans to move AtomicReference to the java.lang.ref package? 
> Just interesting to understand what was the idea behind the 
> AtomicReference implementation. AtomicReference is used for 
> concurrency reason and its some sort of a strong reference. So it 
> makes sense to put it under concurrency package but at the same time 
> it represents a reference object and the construct for Atomicreference 
> is the same as any other references - AtomicReference aRef_ = new 
> AtomicReference() , or SoftReference sRef_ = new SoftReference();
> The ref package has multiple reference implementations such as 
> Reference, PhantomReference, SoftReference, WeakReference  - and all 
> of them are managed by ReferenceQueue in the direct or abstract way, 
> though AtomicReference does not belong to  ref package and is not 
> extended from Reference class. My understanding is that its not meant 
> to be used in any way with a ReferenceQueue for any type of weak cache 
> implementations either. So should it be under the ref package or under 
> concurrency package if we look at this from high level?
> Seems to me there is some misconception about references which makes 
> it hard to understand in terms of the memory and gc behaviors.
> Thanks,
> DT
> _______________________________________________
> Concurrency-interest mailing list
> Concurrency-interest at cs.oswego.edu
> http://cs.oswego.edu/mailman/listinfo/concurrency-interest

More information about the Concurrency-interest mailing list