In java-8
the new annotation @sun.misc.Contended
appears.
There are several well written articles, which explain what it does and how to use it:
But what is not explained anywhere, is what is the value
of this annotation? I mean, for example in java.lang.Thread
it is used like:
@sun.misc.Contended("tlr")
int threadLocalRandomProbe;
What is this "tlr"
value? What does it influence? What will happen if this value
will be default (empty)?
Taken from grepcode.com -> Contended:
A
@Contended
field annotation may optionally include a contention group tag. A contention group defines a set of one or more fields that collectively must be isolated from all other contention groups. The fields in the same contention group may not be pairwise isolated. With no contention group tag (or with the default empty tag: "") each@Contended
field resides in its own distinct and anonymous contention group.
The value
is documented with
The (optional) contention group tag. This tag is only meaningful for field level annotations.
Therefore the "tlr"
is simply a chose group name for this int threadLocalRandomProbe
- if you annotate a second variable with the same group tag they will be grouped together and isolated together.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With