[concurrency-interest] @Contended (JEP-142)

Remi Forax forax at univ-mlv.fr
Thu Nov 29 09:58:56 EST 2012


On 11/29/2012 03:14 PM, √iktor Ҡlang wrote:
>
>
>
> On Thu, Nov 29, 2012 at 3:06 PM, Stanimir Simeonoff 
> <stanimir at riflexo.com <mailto:stanimir at riflexo.com>> wrote:
>
>
>
>         On Thu, Nov 29, 2012 at 12:40 PM, Stanimir Simeonoff
>         <stanimir at riflexo.com <mailto:stanimir at riflexo.com>> wrote:
>
>             Problem w/ sun.misc is that it requires security
>             permissions on runtime whilst it's an absolutely harmless
>             operation. To avoid that people will just keep padding
>             like it's done now - i.e. nothing achieved.
>
>
>             For instance, I can live by extending j.u.c.atomics even
>             it's ugly just to avoid touching Unsafe itself (or the
>             AtomicUpdaters)
>
>
>         That doesn't address the need for padding.
>
>
>     It's a similar example when you can skip resorting to the Unsafe
>     (and keep performance) - there is a way to do it even if it's ugly.
>
>
> No, Java doesn't have MI so it only works for single-fields, which is 
> extremely limiting.
>
>     Similar fate may follow sun.misc.Contended - even now it's
>     possible to emulate padding but an attempt to improve the case by
>     having it in sun.misc is neither portable nor a security friendly
>     approach.
>
>
> The deal breaker for the annotation is that it breaks the program if 
> the annotation doesn't exist in that version of the JVM.

correct me if I'm wrong but if the annotation is not present in the 
classpath there is no problem until your program uses reflection on the 
field and ask for all annotations using field.getAnnotations().

>
> Cheers,
>
Rémi



More information about the Concurrency-interest mailing list