[concurrency-interest] @Contended (JEP-142)
hallorant at gmail.com
Tue Nov 27 13:39:39 EST 2012
On Tue, Nov 27, 2012 at 1:01 PM, Doug Lea <dl at cs.oswego.edu> wrote:
> On 11/27/12 12:51, √iktor Ҡlang wrote:
>> So how would I use it within Akka for instance? (embed jsr166 and accept
>> potential duplicate definitions?)
> You'll need to wait for a JVM (or preliminary build) that supports it,
> and then import sun.misc.Contended. That is one reason to place this
> in a JVM-dependent package -- the annotation does you no good
> without JVM support.
(obvious) This could make it potentially annoying to move sources from
JVM implementation to another. If the sun.misc package is removed
from the javac classpath the sources will not compile. Of course, a
savvy user, which is likely to be anyone trying this out, could create
this annotation in their source tree or make their own Jar.
(point) The implementation in the JVM could consider a "sloppy"
matching scheme which ignores the package -- so that, for example,
com.my.code.Contended works just as well as sun.misc.Contended. This
is easy to do, and I'm guessing there is an -XX: flag in the work to
turn the whole scheme off in the unlikely case @Contended means the
field was discussed in a code inspection (or some other nonsense).
This seems like a useful feature, happy hacking!
More information about the Concurrency-interest