RFR (S): JEP-142: Reduce Cache Contention on Specified Fields

Martijn Verburg martijnverburg at gmail.com
Mon Nov 26 11:07:58 PST 2012

Hi Aleksey,

On 26 November 2012 18:40, Aleksey Shipilev <aleksey.shipilev at oracle.com>wrote:

> On 11/26/2012 09:35 PM, Remi Forax wrote:
> > On 11/26/2012 05:44 PM, Aleksey Shipilev wrote:
> >> On 11/26/2012 08:22 PM, Doug Lea wrote:
> >>> One small suggestion to slightly appease the nanny-state folks.
> >>> How about burying the annotation one lever deeper to
> >>> java.util.concurrent.atomic.
> >
> > +1
> >
> Still fail to see the rationale about this.

I think (as others have posted) that this is one of the rare cases where a
Java developer is deliberately encouraged to bypass the runtime
environment's heuristics. This is not common behaviour. Similar
functionality has traditionally been hidden as deeply as possible to try
and protect people from themselves (like having access to pointers via

It's interesting to note that Unsafe is pretty much only used by extremely
expert library authors (such as Cliff Click and Doug Lea).  I think this
@Contended annotation is in that same category despite how personally
excited about it.

The more I've thought about this, the more I realise that this is a feature
that if broadly advertised and adopted could lead a lot of developers
shooting themselves in the foot.


More information about the hotspot-dev mailing list