Package Summary Overview Summary |
public abstract class VarHandle extends Object
VarHandles are immutable and have no visible state. VarHandles cannot be subclassed by the user.
A VarHandle has:
variable type
, referred to as T
, which is the type of variable(s) referenced by this VarHandle; coordinate types
, referred to as CT
, where the types (primitive and reference) are represented by Class
objects). A list of arguments corresponding to instances of the coordinate types uniquely locates a variable referenced by this VarHandle; and (CT : T)
. An empty list of coordinate types is declared as (empty)
. Factory methods that produce or lookup
VarHandle instances document the supported variable type, coordinate types, and shape. For example, a VarHandle referencing a non-static field will declare a shape of (R : T)
, where R
is the receiver type and T
is the field type, and where the VarHandle and an instance of the receiver type can be utilized to access the field variable. A VarHandle referencing array elements will declare a shape of (T[], int : T)
, where T[]
is the array type and T
its component type, and where the VarHandle, an instance of the array type, and an int
index can be utilized to access an array element variable.
Each access mode is associated with a signature polymorphic method of the same name, where the VarHandle shape and access mode uniquely determine the canonical access mode type
, which in turn determines the matching constraints on a valid symbolic type descriptor at the call site of an access mode's method invocation. As such, VarHandles are dynamically and strongly typed. Their arity, argument types, and return type of an access mode method invocation are not statically checked. If they, and associated values, do not match the arity and types of the access mode's type, an exception will be thrown. The parameter types of an access mode method type will consist of those that are the VarHandles's coordinate types (in order), followed by access mode parameter types specific to the access mode.
An access mode's method documents the form of its method signature, which is derived from the access mode parameter types. The form is declared with the notation (CT, P1 p1, P2 p2, ..., PN pn)R
, where CT
is the coordinate types (as documented by a VarHandle factory method), P1
, P2
and PN
are the first, second and the n'th access mode parameters named p1
, p2
and pn
respectively, and R
is the return type. For example, for the generic shape of (CT : T)
the compareAndSet(java.lang.Object...)
access mode method documents that its method signature is of the form (CT, T expectedValue, T newValue)boolean
, where the parameter types named extendedValue
and newValue
are the access mode parameter types. If the VarHandle accesses array elements with a shape of say (T[], int : T)
then the access mode method type is (T[], int, T, T)boolean
.
Access modes are grouped into the following categories:
get
, getVolatile
, getAcquire
, getOpaque
. set
, setVolatile
, setRelease
, setOpaque
. compareAndSet
, weakCompareAndSetPlain
, weakCompareAndSet
, weakCompareAndSetAcquire
, weakCompareAndSetRelease
, compareAndExchangeAcquire
, compareAndExchange
, compareAndExchangeRelease
, getAndSet
, getAndSetAcquire
, getAndSetRelease
. getAndAdd
, getAndAddAcquire
, getAndAddRelease
, getAndBitwiseOr
, getAndBitwiseOrAcquire
, getAndBitwiseOrRelease
, getAndBitwiseAnd
, getAndBitwiseAndAcquire
, getAndBitwiseAndRelease
, getAndBitwiseXor
, getAndBitwiseXorAcquire
, getAndBitwiseXorRelease
. Factory methods that produce or lookup
VarHandle instances document the set of access modes that are supported, which may also include documenting restrictions based on the variable type and whether a variable is read-only. If an access mode is not supported then the corresponding signature-polymorphic method will on invocation throw an UnsupportedOperationException
. Factory methods should document any additional undeclared exceptions that may be thrown by access mode methods. The get
access mode is supported for all VarHandle instances and the corresponding method never throws UnsupportedOperationException
. If a VarHandle references a read-only variable (for example a final
field) then write, atomic update, numeric atomic update, and bitwise atomic update access modes are not supported and corresponding methods throw UnsupportedOperationException
. Read/write access modes (if supported), with the exception of get
and set
, provide atomic access for reference types and all primitive types. Unless stated otherwise in the documentation of a factory method, the access modes get
and set
(if supported) provide atomic access for reference types and all primitives types, with the exception of long
and double
on 32-bit platforms.
Access modes will override any memory ordering effects specified at the declaration site of a variable. For example, a VarHandle accessing a a field using the get
access mode will access the field as specified by its access mode even if that field is declared volatile
. When mixed access is performed extreme care should be taken since the Java Memory Model may permit surprising results.
In addition to supporting access to variables under various access modes, a set of static methods, referred to as memory fence methods, is also provided for fine-grained control of memory ordering. The Java Language Specification permits other threads to observe operations as if they were executed in orders different than are apparent in program source code, subject to constraints arising, for example, from the use of locks, volatile
fields or VarHandles. The static methods, fullFence
, acquireFence
, releaseFence
, loadLoadFence
and storeStoreFence
, can also be used to impose constraints. Their specifications, as is the case for certain access modes, are phrased in terms of the lack of "reorderings" -- observable ordering effects that might otherwise occur if the fence was not present. More precise phrasing of the specification of access mode methods and memory fence methods may accompany future updates of the Java Language Specification.
Object
arguments and Object
return types (if the return type is polymorphic), but they have an additional quality called signature polymorphism which connects this freedom of invocation directly to the JVM execution stack. As is usual with virtual methods, source-level calls to access mode methods compile to an invokevirtual
instruction. More unusually, the compiler must record the actual argument types, and may not perform method invocation conversions on the arguments. Instead, it must generate instructions to push them on the stack according to their own unconverted types. The VarHandle object itself will be pushed on the stack before the arguments. The compiler then generates an invokevirtual
instruction that invokes the access mode method with a symbolic type descriptor which describes the argument and return types.
To issue a complete symbolic type descriptor, the compiler must also determine the return type (if polymorphic). This is based on a cast on the method invocation expression, if there is one, or else Object
if the invocation is an expression, or else void
if the invocation is a statement. The cast may be to a primitive type (but not void
).
As a corner case, an uncasted null
argument is given a symbolic type descriptor of java.lang.Void
. The ambiguity with the type Void
is harmless, since there are no references of type Void
except the null reference.
invokevirtual
instruction is executed it is linked by symbolically resolving the names in the instruction and verifying that the method call is statically legal. This also holds for calls to access mode methods. In this case, the symbolic type descriptor emitted by the compiler is checked for correct syntax, and names it contains are resolved. Thus, an invokevirtual
instruction which invokes an access mode method will always link, as long as the symbolic type descriptor is syntactically well-formed and the types exist. When the invokevirtual
is executed after linking, the receiving VarHandle's access mode type is first checked by the JVM to ensure that it matches the symbolic type descriptor. If the type match fails, it means that the access mode method which the caller is invoking is not present on the individual VarHandle being invoked.
Invocation of an access mode's signature-polymorphic method behaves as if an invocation of MethodHandle.invoke(java.lang.Object...)
, where the receiving method handle is bound to a VarHandle instance and the access mode. More specifically, the following:
VarHandle vh = ..
R r = (R) vh.{access-mode}(p1, p2, ..., pN);
behaves as if (modulo the access mode methods do not declare throwing of Throwable
):
VarHandle vh = ..
MethodHandle mh = MethodHandles.varHandleExactInvoker(
VarHandle.AccessMode.{access-mode},
vh.accessModeType(VarHandle.AccessMode.{access-mode}));
mh = mh.bindTo(vh);
R r = (R) mh.invoke(p1, p2, ..., pN)
or, more concisely, behaves as if:
VarHandle vh = ..
MethodHandle mh = vh.toMethodHandle(VarHandle.AccessMode.{access-mode});
R r = (R) mh.invoke(p1, p2, ..., pN)
In terms of equivalent invokevirtual
bytecode behaviour an access mode method invocation is equivalent to:
MethodHandle mh = MethodHandles.lookup().findVirtual(
VarHandle.class,
VarHandle.AccessMode.{access-mode}.methodName(),
MethodType.methodType(R, p1, p2, ..., pN));
R r = (R) mh.invokeExact(vh, p1, p2, ..., pN)
where the desired method type is the symbolic type descriptor and a MethodHandle.invokeExact(java.lang.Object...)
is performed, since before invocation of the target, the handle will apply reference casts as necessary and box, unbox, or widen primitive values, as if by asType
(see also MethodHandles.varHandleInvoker(java.lang.invoke.VarHandle.AccessMode, java.lang.invoke.MethodType)
).
WrongMethodTypeException
. Thus, an access mode type mismatch which might show up as a linkage error in a statically typed program can show up as a dynamic WrongMethodTypeException
in a program which uses VarHandles.
Because access mode types contain "live" Class
objects, method type matching takes into account both type names and class loaders. Thus, even if a VarHandle VH
is created in one class loader L1
and used in another L2
, VarHandle access mode method calls are type-safe, because the caller's symbolic type descriptor, as resolved in L2
, is matched against the original callee method's symbolic type descriptor, as resolved in L1
. The resolution in L1
happens when VH
is created and its access mode types are assigned, while the resolution in L2
happens when the invokevirtual
instruction is linked.
Apart from type descriptor checks, a VarHandles's capability to access it's variables is unrestricted. If a VarHandle is formed on a non-public variable by a class that has access to that variable, the resulting VarHandle can be used in any place by any caller who receives a reference to it.
Unlike with the Core Reflection API, where access is checked every time a reflective method is invoked, VarHandle access checking is performed when the VarHandle is created . Thus, VarHandles to non-public variables, or to variables in non-public classes, should generally be kept secret. They should not be passed to untrusted code unless their use from the untrusted code would be harmless.
MethodHandles.Lookup
. For example, a VarHandle for a non-static field can be obtained from Lookup.findVarHandle
. There is also a conversion method from Core Reflection API objects, Lookup.unreflectVarHandle
.Access to protected field members is restricted to receivers only of the accessing class, or one of its subclasses, and the accessing class must in turn be a subclass (or package sibling) of the protected member's defining class. If a VarHandle refers to a protected non-static field of a declaring class outside the current package, the receiver argument will be narrowed to the type of the accessing class.
Lookup
API, any field represented by a Core Reflection API object can be converted to a behaviorally equivalent VarHandle. For example, a reflective Field
can be converted to a VarHandle using Lookup.unreflectVarHandle
. The resulting VarHandles generally provide more direct and efficient access to the underlying fields. As a special case, when the Core Reflection API is used to view the signature polymorphic access mode methods in this class, they appear as ordinary non-polymorphic methods. Their reflective appearance, as viewed by Class.getDeclaredMethod
, is unaffected by their special status in this API. For example, Method.getModifiers
will report exactly those modifier bits required for any similarly declared method, including in this case native
and varargs
bits.
As with any reflected method, these methods (when reflected) may be invoked directly via java.lang.reflect.Method.invoke
, via JNI, or indirectly via Lookup.unreflect
. However, such reflective calls do not result in access mode method invocations. Such a call, if passed the required argument (a single one, of type Object[]
), will ignore the argument and will throw an UnsupportedOperationException
.
Since invokevirtual
instructions can natively invoke VarHandle access mode methods under any symbolic type descriptor, this reflective view conflicts with the normal presentation of these methods via bytecodes. Thus, these native methods, when reflectively viewed by Class.getDeclaredMethod
, may be regarded as placeholders only.
In order to obtain an invoker method for a particular access mode type, use MethodHandles.varHandleExactInvoker(java.lang.invoke.VarHandle.AccessMode, java.lang.invoke.MethodType)
or MethodHandles.varHandleInvoker(java.lang.invoke.VarHandle.AccessMode, java.lang.invoke.MethodType)
. The Lookup.findVirtual
API is also able to return a method handle to call an access mode method for any specified access mode type and is equivalent in behaviour to MethodHandles.varHandleInvoker(java.lang.invoke.VarHandle.AccessMode, java.lang.invoke.MethodType)
.
invokevirtual
instruction. MethodHandle
, MethodHandles
, MethodType
Modifier and Type | Class | Description |
---|---|---|
static class | VarHandle.AccessMode |
The set of access modes that specify how a variable, referenced by a VarHandle, is accessed.
|
Modifier and Type | Method | Description |
---|---|---|
MethodType | accessModeType(VarHandle.AccessMode accessMode) |
Obtains the canonical access mode type for this VarHandle and a given access mode.
|
static void | acquireFence() |
Ensures that loads before the fence will not be reordered with loads and stores after the fence.
|
Object | compareAndExchange(Object... args) |
Atomically sets the value of a variable to the
newValue with the memory semantics of setVolatile(java.lang.Object...) if the variable's current value, referred to as the witness value , == the expectedValue , as accessed with the memory semantics of getVolatile(java.lang.Object...) . |
Object | compareAndExchangeAcquire(Object... args) |
Atomically sets the value of a variable to the
newValue with the memory semantics of set(java.lang.Object...) if the variable's current value, referred to as the witness value , == the expectedValue , as accessed with the memory semantics of getAcquire(java.lang.Object...) . |
Object | compareAndExchangeRelease(Object... args) |
Atomically sets the value of a variable to the
newValue with the memory semantics of setRelease(java.lang.Object...) if the variable's current value, referred to as the witness value , == the expectedValue , as accessed with the memory semantics of get(java.lang.Object...) . |
boolean | compareAndSet(Object... args) |
Atomically sets the value of a variable to the
newValue with the memory semantics of setVolatile(java.lang.Object...) if the variable's current value, referred to as the witness value , == the expectedValue , as accessed with the memory semantics of getVolatile(java.lang.Object...) . |
List<Class<?>> | coordinateTypes() |
Returns the coordinate types for this VarHandle.
|
static void | fullFence() |
Ensures that loads and stores before the fence will not be reordered with loads and stores after the fence.
|
Object | get(Object... args) |
Returns the value of a variable, with memory semantics of reading as if the variable was declared non-
volatile . |
Object | getAcquire(Object... args) |
Returns the value of a variable, and ensures that subsequent loads and stores are not reordered before this access.
|
Object | getAndAdd(Object... args) |
Atomically adds the
value to the current value of a variable with the memory semantics of setVolatile(java.lang.Object...) , and returns the variable's previous value, as accessed with the memory semantics of getVolatile(java.lang.Object...) . |
Object | getAndAddAcquire(Object... args) |
Atomically adds the
value to the current value of a variable with the memory semantics of set(java.lang.Object...) , and returns the variable's previous value, as accessed with the memory semantics of getAcquire(java.lang.Object...) . |
Object | getAndAddRelease(Object... args) |
Atomically adds the
value to the current value of a variable with the memory semantics of setRelease(java.lang.Object...) , and returns the variable's previous value, as accessed with the memory semantics of get(java.lang.Object...) . |
Object | getAndBitwiseAnd(Object... args) |
Atomically sets the value of a variable to the result of bitwise AND between the variable's current value and the
mask with the memory semantics of setVolatile(java.lang.Object...) and returns the variable's previous value, as accessed with the memory semantics of getVolatile(java.lang.Object...) . |
Object | getAndBitwiseAndAcquire(Object... args) |
Atomically sets the value of a variable to the result of bitwise AND between the variable's current value and the
mask with the memory semantics of set(java.lang.Object...) and returns the variable's previous value, as accessed with the memory semantics of getAcquire(java.lang.Object...) . |
Object | getAndBitwiseAndRelease(Object... args) |
Atomically sets the value of a variable to the result of bitwise AND between the variable's current value and the
mask with the memory semantics of setRelease(java.lang.Object...) and returns the variable's previous value, as accessed with the memory semantics of get(java.lang.Object...) . |
Object | getAndBitwiseOr(Object... args) |
Atomically sets the value of a variable to the result of bitwise OR between the variable's current value and the
mask with the memory semantics of setVolatile(java.lang.Object...) and returns the variable's previous value, as accessed with the memory semantics of getVolatile(java.lang.Object...) . |
Object | getAndBitwiseOrAcquire(Object... args) |
Atomically sets the value of a variable to the result of bitwise OR between the variable's current value and the
mask with the memory semantics of set(java.lang.Object...) and returns the variable's previous value, as accessed with the memory semantics of getAcquire(java.lang.Object...) . |
Object | getAndBitwiseOrRelease(Object... args) |
Atomically sets the value of a variable to the result of bitwise OR between the variable's current value and the
mask with the memory semantics of setRelease(java.lang.Object...) and returns the variable's previous value, as accessed with the memory semantics of get(java.lang.Object...) . |
Object | getAndBitwiseXor(Object... args) |
Atomically sets the value of a variable to the result of bitwise XOR between the variable's current value and the
mask with the memory semantics of setVolatile(java.lang.Object...) and returns the variable's previous value, as accessed with the memory semantics of getVolatile(java.lang.Object...) . |
Object | getAndBitwiseXorAcquire(Object... args) |
Atomically sets the value of a variable to the result of bitwise XOR between the variable's current value and the
mask with the memory semantics of set(java.lang.Object...) and returns the variable's previous value, as accessed with the memory semantics of getAcquire(java.lang.Object...) . |
Object | getAndBitwiseXorRelease(Object... args) |
Atomically sets the value of a variable to the result of bitwise XOR between the variable's current value and the
mask with the memory semantics of setRelease(java.lang.Object...) and returns the variable's previous value, as accessed with the memory semantics of get(java.lang.Object...) . |
Object | getAndSet(Object... args) |
Atomically sets the value of a variable to the
newValue with the memory semantics of setVolatile(java.lang.Object...) and returns the variable's previous value, as accessed with the memory semantics of getVolatile(java.lang.Object...) . |
Object | getAndSetAcquire(Object... args) |
Atomically sets the value of a variable to the
newValue with the memory semantics of set(java.lang.Object...) and returns the variable's previous value, as accessed with the memory semantics of getAcquire(java.lang.Object...) . |
Object | getAndSetRelease(Object... args) |
Atomically sets the value of a variable to the
newValue with the memory semantics of setRelease(java.lang.Object...) and returns the variable's previous value, as accessed with the memory semantics of get(java.lang.Object...) . |
Object | getOpaque(Object... args) |
Returns the value of a variable, accessed in program order, but with no assurance of memory ordering effects with respect to other threads.
|
Object | getVolatile(Object... args) |
Returns the value of a variable, with memory semantics of reading as if the variable was declared
volatile . |
boolean | isAccessModeSupported(VarHandle.AccessMode accessMode) |
Returns
true if the given access mode is supported, otherwise false . |
static void | loadLoadFence() |
Ensures that loads before the fence will not be reordered with loads after the fence.
|
static void | releaseFence() |
Ensures that loads and stores before the fence will not be reordered with stores after the fence.
|
void | set(Object... args) |
Sets the value of a variable to the
newValue , with memory semantics of setting as if the variable was declared non-volatile and non-final . |
void | setOpaque(Object... args) |
Sets the value of a variable to the
newValue , in program order, but with no assurance of memory ordering effects with respect to other threads. |
void | setRelease(Object... args) |
Sets the value of a variable to the
newValue , and ensures that prior loads and stores are not reordered after this access. |
void | setVolatile(Object... args) |
Sets the value of a variable to the
newValue , with memory semantics of setting as if the variable was declared volatile . |
static void | storeStoreFence() |
Ensures that stores before the fence will not be reordered with stores after the fence.
|
MethodHandle | toMethodHandle(VarHandle.AccessMode accessMode) |
Obtains a method handle bound to this VarHandle and the given access mode.
|
Class<?> | varType() |
Returns the variable type of variables referenced by this VarHandle.
|
boolean | weakCompareAndSet(Object... args) |
Possibly atomically sets the value of a variable to the
newValue with the memory semantics of setVolatile(java.lang.Object...) if the variable's current value, referred to as the witness value , == the expectedValue , as accessed with the memory semantics of getVolatile(java.lang.Object...) . |
boolean | weakCompareAndSetAcquire(Object... args) |
Possibly atomically sets the value of a variable to the
newValue with the semantics of set(java.lang.Object...) if the variable's current value, referred to as the witness value , == the expectedValue , as accessed with the memory semantics of getAcquire(java.lang.Object...) . |
boolean | weakCompareAndSetPlain(Object... args) |
Possibly atomically sets the value of a variable to the
newValue with the semantics of set(java.lang.Object...) if the variable's current value, referred to as the witness value , == the expectedValue , as accessed with the memory semantics of get(java.lang.Object...) . |
boolean | weakCompareAndSetRelease(Object... args) |
Possibly atomically sets the value of a variable to the
newValue with the semantics of setRelease(java.lang.Object...) if the variable's current value, referred to as the witness value , == the expectedValue , as accessed with the memory semantics of get(java.lang.Object...) . |
public final Object get(Object... args)
volatile
. Commonly referred to as plain read access.The method signature is of the form (CT)T
.
The symbolic type descriptor at the call site of get
must match the access mode type that is the result of calling accessModeType(VarHandle.AccessMode.GET)
on this VarHandle.
This access mode is supported by all VarHandle instances and never throws UnsupportedOperationException
.
args
- the signature-polymorphic parameter list of the form (CT)
, statically represented using varargs. Object
. WrongMethodTypeException
- if the access mode type is not compatible with the caller's symbolic type descriptor. ClassCastException
- if the access mode type is compatible with the caller's symbolic type descriptor, but a reference cast fails. public final void set(Object... args)
newValue
, with memory semantics of setting as if the variable was declared non-volatile
and non-final
. Commonly referred to as plain write access.The method signature is of the form (CT, T newValue)void
The symbolic type descriptor at the call site of set
must match the access mode type that is the result of calling accessModeType(VarHandle.AccessMode.SET)
on this VarHandle.
args
- the signature-polymorphic parameter list of the form (CT, T newValue)
, statically represented using varargs. UnsupportedOperationException
- if the access mode is unsupported for this VarHandle. WrongMethodTypeException
- if the access mode type is not compatible with the caller's symbolic type descriptor. ClassCastException
- if the access mode type is compatible with the caller's symbolic type descriptor, but a reference cast fails. public final Object getVolatile(Object... args)
volatile
.The method signature is of the form (CT)T
.
The symbolic type descriptor at the call site of getVolatile
must match the access mode type that is the result of calling accessModeType(VarHandle.AccessMode.GET_VOLATILE)
on this VarHandle.
args
- the signature-polymorphic parameter list of the form (CT)
, statically represented using varargs. Object
. UnsupportedOperationException
- if the access mode is unsupported for this VarHandle. WrongMethodTypeException
- if the access mode type is not compatible with the caller's symbolic type descriptor. ClassCastException
- if the access mode type is compatible with the caller's symbolic type descriptor, but a reference cast fails. public final void setVolatile(Object... args)
newValue
, with memory semantics of setting as if the variable was declared volatile
.The method signature is of the form (CT, T newValue)void
.
The symbolic type descriptor at the call site of setVolatile
must match the access mode type that is the result of calling accessModeType(VarHandle.AccessMode.SET_VOLATILE)
on this VarHandle.
memory_order_seq_cst
. args
- the signature-polymorphic parameter list of the form (CT, T newValue)
, statically represented using varargs. UnsupportedOperationException
- if the access mode is unsupported for this VarHandle. WrongMethodTypeException
- if the access mode type is not compatible with the caller's symbolic type descriptor. ClassCastException
- if the access mode type is compatible with the caller's symbolic type descriptor, but a reference cast fails. public final Object getOpaque(Object... args)
The method signature is of the form (CT)T
.
The symbolic type descriptor at the call site of getOpaque
must match the access mode type that is the result of calling accessModeType(VarHandle.AccessMode.GET_OPAQUE)
on this VarHandle.
args
- the signature-polymorphic parameter list of the form (CT)
, statically represented using varargs. Object
. UnsupportedOperationException
- if the access mode is unsupported for this VarHandle. WrongMethodTypeException
- if the access mode type is not compatible with the caller's symbolic type descriptor. ClassCastException
- if the access mode type is compatible with the caller's symbolic type descriptor, but a reference cast fails. public final void setOpaque(Object... args)
newValue
, in program order, but with no assurance of memory ordering effects with respect to other threads.The method signature is of the form (CT, T newValue)void
.
The symbolic type descriptor at the call site of setOpaque
must match the access mode type that is the result of calling accessModeType(VarHandle.AccessMode.SET_OPAQUE)
on this VarHandle.
args
- the signature-polymorphic parameter list of the form (CT, T newValue)
, statically represented using varargs. UnsupportedOperationException
- if the access mode is unsupported for this VarHandle. WrongMethodTypeException
- if the access mode type is not compatible with the caller's symbolic type descriptor. ClassCastException
- if the access mode type is compatible with the caller's symbolic type descriptor, but a reference cast fails. public final Object getAcquire(Object... args)
The method signature is of the form (CT)T
.
The symbolic type descriptor at the call site of getAcquire
must match the access mode type that is the result of calling accessModeType(VarHandle.AccessMode.GET_ACQUIRE)
on this VarHandle.
memory_order_acquire
ordering. args
- the signature-polymorphic parameter list of the form (CT)
, statically represented using varargs. Object
. UnsupportedOperationException
- if the access mode is unsupported for this VarHandle. WrongMethodTypeException
- if the access mode type is not compatible with the caller's symbolic type descriptor. ClassCastException
- if the access mode type is compatible with the caller's symbolic type descriptor, but a reference cast fails. public final void setRelease(Object... args)
newValue
, and ensures that prior loads and stores are not reordered after this access.The method signature is of the form (CT, T newValue)void
.
The symbolic type descriptor at the call site of setRelease
must match the access mode type that is the result of calling accessModeType(VarHandle.AccessMode.SET_RELEASE)
on this VarHandle.
memory_order_release
ordering. args
- the signature-polymorphic parameter list of the form (CT, T newValue)
, statically represented using varargs. UnsupportedOperationException
- if the access mode is unsupported for this VarHandle. WrongMethodTypeException
- if the access mode type is not compatible with the caller's symbolic type descriptor. ClassCastException
- if the access mode type is compatible with the caller's symbolic type descriptor, but a reference cast fails. public final boolean compareAndSet(Object... args)
newValue
with the memory semantics of setVolatile(java.lang.Object...)
if the variable's current value, referred to as the witness value , ==
the expectedValue
, as accessed with the memory semantics of getVolatile(java.lang.Object...)
.The method signature is of the form (CT, T expectedValue, T newValue)boolean
.
The symbolic type descriptor at the call site of compareAndSet
must match the access mode type that is the result of calling accessModeType(VarHandle.AccessMode.COMPARE_AND_SET)
on this VarHandle.
args
- the signature-polymorphic parameter list of the form (CT, T expectedValue, T newValue)
, statically represented using varargs. true
if successful, otherwise false
if the witness value was not the same as the expectedValue
. UnsupportedOperationException
- if the access mode is unsupported for this VarHandle. WrongMethodTypeException
- if the access mode type is not compatible with the caller's symbolic type descriptor. ClassCastException
- if the access mode type is compatible with the caller's symbolic type descriptor, but a reference cast fails. setVolatile(Object...)
, getVolatile(Object...)
public final Object compareAndExchange(Object... args)
newValue
with the memory semantics of setVolatile(java.lang.Object...)
if the variable's current value, referred to as the witness value , ==
the expectedValue
, as accessed with the memory semantics of getVolatile(java.lang.Object...)
.The method signature is of the form (CT, T expectedValue, T newValue)T
.
The symbolic type descriptor at the call site of compareAndExchange
must match the access mode type that is the result of calling accessModeType(VarHandle.AccessMode.COMPARE_AND_EXCHANGE)
on this VarHandle.
args
- the signature-polymorphic parameter list of the form (CT, T expectedValue, T newValue)
, statically represented using varargs. expectedValue
if successful , statically represented using Object
. UnsupportedOperationException
- if the access mode is unsupported for this VarHandle. WrongMethodTypeException
- if the access mode type is not compatible with the caller's symbolic type descriptor. ClassCastException
- if the access mode type is compatible with the caller's symbolic type descriptor, but a reference cast fails. setVolatile(Object...)
, getVolatile(Object...)
public final Object compareAndExchangeAcquire(Object... args)
newValue
with the memory semantics of set(java.lang.Object...)
if the variable's current value, referred to as the witness value , ==
the expectedValue
, as accessed with the memory semantics of getAcquire(java.lang.Object...)
.The method signature is of the form (CT, T expectedValue, T newValue)T
.
The symbolic type descriptor at the call site of compareAndExchangeAcquire
must match the access mode type that is the result of calling accessModeType(VarHandle.AccessMode.COMPARE_AND_EXCHANGE_ACQUIRE)
on this VarHandle.
args
- the signature-polymorphic parameter list of the form (CT, T expectedValue, T newValue)
, statically represented using varargs. expectedValue
if successful , statically represented using Object
. UnsupportedOperationException
- if the access mode is unsupported for this VarHandle. WrongMethodTypeException
- if the access mode type is not compatible with the caller's symbolic type descriptor. ClassCastException
- if the access mode type is compatible with the caller's symbolic type descriptor, but a reference cast fails. set(Object...)
, getAcquire(Object...)
public final Object compareAndExchangeRelease(Object... args)
newValue
with the memory semantics of setRelease(java.lang.Object...)
if the variable's current value, referred to as the witness value , ==
the expectedValue
, as accessed with the memory semantics of get(java.lang.Object...)
.The method signature is of the form (CT, T expectedValue, T newValue)T
.
The symbolic type descriptor at the call site of compareAndExchangeRelease
must match the access mode type that is the result of calling accessModeType(VarHandle.AccessMode.COMPARE_AND_EXCHANGE_RELEASE)
on this VarHandle.
args
- the signature-polymorphic parameter list of the form (CT, T expectedValue, T newValue)
, statically represented using varargs. expectedValue
if successful , statically represented using Object
. UnsupportedOperationException
- if the access mode is unsupported for this VarHandle. WrongMethodTypeException
- if the access mode type is not compatible with the caller's symbolic type descriptor. ClassCastException
- if the access mode type is compatible with the caller's symbolic type descriptor, but a reference cast fails. setRelease(Object...)
, get(Object...)
public final boolean weakCompareAndSetPlain(Object... args)
newValue
with the semantics of set(java.lang.Object...)
if the variable's current value, referred to as the witness value , ==
the expectedValue
, as accessed with the memory semantics of get(java.lang.Object...)
.This operation may fail spuriously (typically, due to memory contention) even if the witness value does match the expected value.
The method signature is of the form (CT, T expectedValue, T newValue)boolean
.
The symbolic type descriptor at the call site of weakCompareAndSetPlain
must match the access mode type that is the result of calling accessModeType(VarHandle.AccessMode.WEAK_COMPARE_AND_SET_PLAIN)
on this VarHandle.
args
- the signature-polymorphic parameter list of the form (CT, T expectedValue, T newValue)
, statically represented using varargs. true
if successful, otherwise false
if the witness value was not the same as the expectedValue
or if this operation spuriously failed. UnsupportedOperationException
- if the access mode is unsupported for this VarHandle. WrongMethodTypeException
- if the access mode type is not compatible with the caller's symbolic type descriptor. ClassCastException
- if the access mode type is compatible with the caller's symbolic type descriptor, but a reference cast fails. set(Object...)
, get(Object...)
public final boolean weakCompareAndSet(Object... args)
newValue
with the memory semantics of setVolatile(java.lang.Object...)
if the variable's current value, referred to as the witness value , ==
the expectedValue
, as accessed with the memory semantics of getVolatile(java.lang.Object...)
.This operation may fail spuriously (typically, due to memory contention) even if the witness value does match the expected value.
The method signature is of the form (CT, T expectedValue, T newValue)boolean
.
The symbolic type descriptor at the call site of weakCompareAndSet
must match the access mode type that is the result of calling accessModeType(VarHandle.AccessMode.WEAK_COMPARE_AND_SET)
on this VarHandle.
args
- the signature-polymorphic parameter list of the form (CT, T expectedValue, T newValue)
, statically represented using varargs. true
if successful, otherwise false
if the witness value was not the same as the expectedValue
or if this operation spuriously failed. UnsupportedOperationException
- if the access mode is unsupported for this VarHandle. WrongMethodTypeException
- if the access mode type is not compatible with the caller's symbolic type descriptor. ClassCastException
- if the access mode type is compatible with the caller's symbolic type descriptor, but a reference cast fails. setVolatile(Object...)
, getVolatile(Object...)
public final boolean weakCompareAndSetAcquire(Object... args)
newValue
with the semantics of set(java.lang.Object...)
if the variable's current value, referred to as the witness value , ==
the expectedValue
, as accessed with the memory semantics of getAcquire(java.lang.Object...)
.This operation may fail spuriously (typically, due to memory contention) even if the witness value does match the expected value.
The method signature is of the form (CT, T expectedValue, T newValue)boolean
.
The symbolic type descriptor at the call site of weakCompareAndSetAcquire
must match the access mode type that is the result of calling accessModeType(VarHandle.AccessMode.WEAK_COMPARE_AND_SET_ACQUIRE)
on this VarHandle.
args
- the signature-polymorphic parameter list of the form (CT, T expectedValue, T newValue)
, statically represented using varargs. true
if successful, otherwise false
if the witness value was not the same as the expectedValue
or if this operation spuriously failed. UnsupportedOperationException
- if the access mode is unsupported for this VarHandle. WrongMethodTypeException
- if the access mode type is not compatible with the caller's symbolic type descriptor. ClassCastException
- if the access mode type is compatible with the caller's symbolic type descriptor, but a reference cast fails. set(Object...)
, getAcquire(Object...)
public final boolean weakCompareAndSetRelease(Object... args)
newValue
with the semantics of setRelease(java.lang.Object...)
if the variable's current value, referred to as the witness value , ==
the expectedValue
, as accessed with the memory semantics of get(java.lang.Object...)
.This operation may fail spuriously (typically, due to memory contention) even if the witness value does match the expected value.
The method signature is of the form (CT, T expectedValue, T newValue)boolean
.
The symbolic type descriptor at the call site of weakCompareAndSetRelease
must match the access mode type that is the result of calling accessModeType(VarHandle.AccessMode.WEAK_COMPARE_AND_SET_RELEASE)
on this VarHandle.
args
- the signature-polymorphic parameter list of the form (CT, T expectedValue, T newValue)
, statically represented using varargs. true
if successful, otherwise false
if the witness value was not the same as the expectedValue
or if this operation spuriously failed. UnsupportedOperationException
- if the access mode is unsupported for this VarHandle. WrongMethodTypeException
- if the access mode type is not compatible with the caller's symbolic type descriptor. ClassCastException
- if the access mode type is compatible with the caller's symbolic type descriptor, but a reference cast fails. setRelease(Object...)
, get(Object...)
public final Object getAndSet(Object... args)
newValue
with the memory semantics of setVolatile(java.lang.Object...)
and returns the variable's previous value, as accessed with the memory semantics of getVolatile(java.lang.Object...)
.The method signature is of the form (CT, T newValue)T
.
The symbolic type descriptor at the call site of getAndSet
must match the access mode type that is the result of calling accessModeType(VarHandle.AccessMode.GET_AND_SET)
on this VarHandle.
args
- the signature-polymorphic parameter list of the form (CT, T newValue)
, statically represented using varargs. Object
. UnsupportedOperationException
- if the access mode is unsupported for this VarHandle. WrongMethodTypeException
- if the access mode type is not compatible with the caller's symbolic type descriptor. ClassCastException
- if the access mode type is compatible with the caller's symbolic type descriptor, but a reference cast fails. setVolatile(Object...)
, getVolatile(Object...)
public final Object getAndSetAcquire(Object... args)
newValue
with the memory semantics of set(java.lang.Object...)
and returns the variable's previous value, as accessed with the memory semantics of getAcquire(java.lang.Object...)
.The method signature is of the form (CT, T newValue)T
.
The symbolic type descriptor at the call site of getAndSetAcquire
must match the access mode type that is the result of calling accessModeType(VarHandle.AccessMode.GET_AND_SET_ACQUIRE)
on this VarHandle.
args
- the signature-polymorphic parameter list of the form (CT, T newValue)
, statically represented using varargs. Object
. UnsupportedOperationException
- if the access mode is unsupported for this VarHandle. WrongMethodTypeException
- if the access mode type is not compatible with the caller's symbolic type descriptor. ClassCastException
- if the access mode type is compatible with the caller's symbolic type descriptor, but a reference cast fails. setVolatile(Object...)
, getVolatile(Object...)
public final Object getAndSetRelease(Object... args)
newValue
with the memory semantics of setRelease(java.lang.Object...)
and returns the variable's previous value, as accessed with the memory semantics of get(java.lang.Object...)
.The method signature is of the form (CT, T newValue)T
.
The symbolic type descriptor at the call site of getAndSetRelease
must match the access mode type that is the result of calling accessModeType(VarHandle.AccessMode.GET_AND_SET_RELEASE)
on this VarHandle.
args
- the signature-polymorphic parameter list of the form (CT, T newValue)
, statically represented using varargs. Object
. UnsupportedOperationException
- if the access mode is unsupported for this VarHandle. WrongMethodTypeException
- if the access mode type is not compatible with the caller's symbolic type descriptor. ClassCastException
- if the access mode type is compatible with the caller's symbolic type descriptor, but a reference cast fails. setVolatile(Object...)
, getVolatile(Object...)
public final Object getAndAdd(Object... args)
value
to the current value of a variable with the memory semantics of setVolatile(java.lang.Object...)
, and returns the variable's previous value, as accessed with the memory semantics of getVolatile(java.lang.Object...)
.The method signature is of the form (CT, T value)T
.
The symbolic type descriptor at the call site of getAndAdd
must match the access mode type that is the result of calling accessModeType(VarHandle.AccessMode.GET_AND_ADD)
on this VarHandle.
args
- the signature-polymorphic parameter list of the form (CT, T value)
, statically represented using varargs. Object
. UnsupportedOperationException
- if the access mode is unsupported for this VarHandle. WrongMethodTypeException
- if the access mode type is not compatible with the caller's symbolic type descriptor. ClassCastException
- if the access mode type is compatible with the caller's symbolic type descriptor, but a reference cast fails. setVolatile(Object...)
, getVolatile(Object...)
public final Object getAndAddAcquire(Object... args)
value
to the current value of a variable with the memory semantics of set(java.lang.Object...)
, and returns the variable's previous value, as accessed with the memory semantics of getAcquire(java.lang.Object...)
.The method signature is of the form (CT, T value)T
.
The symbolic type descriptor at the call site of getAndAddAcquire
must match the access mode type that is the result of calling accessModeType(VarHandle.AccessMode.GET_AND_ADD_ACQUIRE)
on this VarHandle.
args
- the signature-polymorphic parameter list of the form (CT, T value)
, statically represented using varargs. Object
. UnsupportedOperationException
- if the access mode is unsupported for this VarHandle. WrongMethodTypeException
- if the access mode type is not compatible with the caller's symbolic type descriptor. ClassCastException
- if the access mode type is compatible with the caller's symbolic type descriptor, but a reference cast fails. setVolatile(Object...)
, getVolatile(Object...)
public final Object getAndAddRelease(Object... args)
value
to the current value of a variable with the memory semantics of setRelease(java.lang.Object...)
, and returns the variable's previous value, as accessed with the memory semantics of get(java.lang.Object...)
.The method signature is of the form (CT, T value)T
.
The symbolic type descriptor at the call site of getAndAddRelease
must match the access mode type that is the result of calling accessModeType(VarHandle.AccessMode.GET_AND_ADD_RELEASE)
on this VarHandle.
args
- the signature-polymorphic parameter list of the form (CT, T value)
, statically represented using varargs. Object
. UnsupportedOperationException
- if the access mode is unsupported for this VarHandle. WrongMethodTypeException
- if the access mode type is not compatible with the caller's symbolic type descriptor. ClassCastException
- if the access mode type is compatible with the caller's symbolic type descriptor, but a reference cast fails. setVolatile(Object...)
, getVolatile(Object...)
public final Object getAndBitwiseOr(Object... args)
mask
with the memory semantics of setVolatile(java.lang.Object...)
and returns the variable's previous value, as accessed with the memory semantics of getVolatile(java.lang.Object...)
.If the variable type is the non-integral boolean
type then a logical OR is performed instead of a bitwise OR.
The method signature is of the form (CT, T mask)T
.
The symbolic type descriptor at the call site of getAndBitwiseOr
must match the access mode type that is the result of calling accessModeType(VarHandle.AccessMode.GET_AND_BITWISE_OR)
on this VarHandle.
args
- the signature-polymorphic parameter list of the form (CT, T mask)
, statically represented using varargs. Object
. UnsupportedOperationException
- if the access mode is unsupported for this VarHandle. WrongMethodTypeException
- if the access mode type is not compatible with the caller's symbolic type descriptor. ClassCastException
- if the access mode type is compatible with the caller's symbolic type descriptor, but a reference cast fails. setVolatile(Object...)
, getVolatile(Object...)
public final Object getAndBitwiseOrAcquire(Object... args)
mask
with the memory semantics of set(java.lang.Object...)
and returns the variable's previous value, as accessed with the memory semantics of getAcquire(java.lang.Object...)
.If the variable type is the non-integral boolean
type then a logical OR is performed instead of a bitwise OR.
The method signature is of the form (CT, T mask)T
.
The symbolic type descriptor at the call site of getAndBitwiseOrAcquire
must match the access mode type that is the result of calling accessModeType(VarHandle.AccessMode.GET_AND_BITWISE_OR_ACQUIRE)
on this VarHandle.
args
- the signature-polymorphic parameter list of the form (CT, T mask)
, statically represented using varargs. Object
. UnsupportedOperationException
- if the access mode is unsupported for this VarHandle. WrongMethodTypeException
- if the access mode type is not compatible with the caller's symbolic type descriptor. ClassCastException
- if the access mode type is compatible with the caller's symbolic type descriptor, but a reference cast fails. set(Object...)
, getAcquire(Object...)
public final Object getAndBitwiseOrRelease(Object... args)
mask
with the memory semantics of setRelease(java.lang.Object...)
and returns the variable's previous value, as accessed with the memory semantics of get(java.lang.Object...)
.If the variable type is the non-integral boolean
type then a logical OR is performed instead of a bitwise OR.
The method signature is of the form (CT, T mask)T
.
The symbolic type descriptor at the call site of getAndBitwiseOrRelease
must match the access mode type that is the result of calling accessModeType(VarHandle.AccessMode.GET_AND_BITWISE_OR_RELEASE)
on this VarHandle.
args
- the signature-polymorphic parameter list of the form (CT, T mask)
, statically represented using varargs. Object
. UnsupportedOperationException
- if the access mode is unsupported for this VarHandle. WrongMethodTypeException
- if the access mode type is not compatible with the caller's symbolic type descriptor. ClassCastException
- if the access mode type is compatible with the caller's symbolic type descriptor, but a reference cast fails. setRelease(Object...)
, get(Object...)
public final Object getAndBitwiseAnd(Object... args)
mask
with the memory semantics of setVolatile(java.lang.Object...)
and returns the variable's previous value, as accessed with the memory semantics of getVolatile(java.lang.Object...)
.If the variable type is the non-integral boolean
type then a logical AND is performed instead of a bitwise AND.
The method signature is of the form (CT, T mask)T
.
The symbolic type descriptor at the call site of getAndBitwiseAnd
must match the access mode type that is the result of calling accessModeType(VarHandle.AccessMode.GET_AND_BITWISE_AND)
on this VarHandle.
args
- the signature-polymorphic parameter list of the form (CT, T mask)
, statically represented using varargs. Object
. UnsupportedOperationException
- if the access mode is unsupported for this VarHandle. WrongMethodTypeException
- if the access mode type is not compatible with the caller's symbolic type descriptor. ClassCastException
- if the access mode type is compatible with the caller's symbolic type descriptor, but a reference cast fails. setVolatile(Object...)
, getVolatile(Object...)
public final Object getAndBitwiseAndAcquire(Object... args)
mask
with the memory semantics of set(java.lang.Object...)
and returns the variable's previous value, as accessed with the memory semantics of getAcquire(java.lang.Object...)
.If the variable type is the non-integral boolean
type then a logical AND is performed instead of a bitwise AND.
The method signature is of the form (CT, T mask)T
.
The symbolic type descriptor at the call site of getAndBitwiseAndAcquire
must match the access mode type that is the result of calling accessModeType(VarHandle.AccessMode.GET_AND_BITWISE_AND_ACQUIRE)
on this VarHandle.
args
- the signature-polymorphic parameter list of the form (CT, T mask)
, statically represented using varargs. Object
. UnsupportedOperationException
- if the access mode is unsupported for this VarHandle. WrongMethodTypeException
- if the access mode type is not compatible with the caller's symbolic type descriptor. ClassCastException
- if the access mode type is compatible with the caller's symbolic type descriptor, but a reference cast fails. set(Object...)
, getAcquire(Object...)
public final Object getAndBitwiseAndRelease(Object... args)
mask
with the memory semantics of setRelease(java.lang.Object...)
and returns the variable's previous value, as accessed with the memory semantics of get(java.lang.Object...)
.If the variable type is the non-integral boolean
type then a logical AND is performed instead of a bitwise AND.
The method signature is of the form (CT, T mask)T
.
The symbolic type descriptor at the call site of getAndBitwiseAndRelease
must match the access mode type that is the result of calling accessModeType(VarHandle.AccessMode.GET_AND_BITWISE_AND_RELEASE)
on this VarHandle.
args
- the signature-polymorphic parameter list of the form (CT, T mask)
, statically represented using varargs. Object
. UnsupportedOperationException
- if the access mode is unsupported for this VarHandle. WrongMethodTypeException
- if the access mode type is not compatible with the caller's symbolic type descriptor. ClassCastException
- if the access mode type is compatible with the caller's symbolic type descriptor, but a reference cast fails. setRelease(Object...)
, get(Object...)
public final Object getAndBitwiseXor(Object... args)
mask
with the memory semantics of setVolatile(java.lang.Object...)
and returns the variable's previous value, as accessed with the memory semantics of getVolatile(java.lang.Object...)
.If the variable type is the non-integral boolean
type then a logical XOR is performed instead of a bitwise XOR.
The method signature is of the form (CT, T mask)T
.
The symbolic type descriptor at the call site of getAndBitwiseXor
must match the access mode type that is the result of calling accessModeType(VarHandle.AccessMode.GET_AND_BITWISE_XOR)
on this VarHandle.
args
- the signature-polymorphic parameter list of the form (CT, T mask)
, statically represented using varargs. Object
. UnsupportedOperationException
- if the access mode is unsupported for this VarHandle. WrongMethodTypeException
- if the access mode type is not compatible with the caller's symbolic type descriptor. ClassCastException
- if the access mode type is compatible with the caller's symbolic type descriptor, but a reference cast fails. setVolatile(Object...)
, getVolatile(Object...)
public final Object getAndBitwiseXorAcquire(Object... args)
mask
with the memory semantics of set(java.lang.Object...)
and returns the variable's previous value, as accessed with the memory semantics of getAcquire(java.lang.Object...)
.If the variable type is the non-integral boolean
type then a logical XOR is performed instead of a bitwise XOR.
The method signature is of the form (CT, T mask)T
.
The symbolic type descriptor at the call site of getAndBitwiseXorAcquire
must match the access mode type that is the result of calling accessModeType(VarHandle.AccessMode.GET_AND_BITWISE_XOR_ACQUIRE)
on this VarHandle.
args
- the signature-polymorphic parameter list of the form (CT, T mask)
, statically represented using varargs. Object
. UnsupportedOperationException
- if the access mode is unsupported for this VarHandle. WrongMethodTypeException
- if the access mode type is not compatible with the caller's symbolic type descriptor. ClassCastException
- if the access mode type is compatible with the caller's symbolic type descriptor, but a reference cast fails. set(Object...)
, getAcquire(Object...)
public final Object getAndBitwiseXorRelease(Object... args)
mask
with the memory semantics of setRelease(java.lang.Object...)
and returns the variable's previous value, as accessed with the memory semantics of get(java.lang.Object...)
.If the variable type is the non-integral boolean
type then a logical XOR is performed instead of a bitwise XOR.
The method signature is of the form (CT, T mask)T
.
The symbolic type descriptor at the call site of getAndBitwiseXorRelease
must match the access mode type that is the result of calling accessModeType(VarHandle.AccessMode.GET_AND_BITWISE_XOR_RELEASE)
on this VarHandle.
args
- the signature-polymorphic parameter list of the form (CT, T mask)
, statically represented using varargs. Object
. UnsupportedOperationException
- if the access mode is unsupported for this VarHandle. WrongMethodTypeException
- if the access mode type is not compatible with the caller's symbolic type descriptor. ClassCastException
- if the access mode type is compatible with the caller's symbolic type descriptor, but a reference cast fails. setRelease(Object...)
, get(Object...)
public final Class<?> varType()
public final List<Class<?>> coordinateTypes()
public final MethodType accessModeType(VarHandle.AccessMode accessMode)
The access mode type's parameter types will consist of a prefix that is the coordinate types of this VarHandle followed by further types as defined by the access mode's method. The access mode type's return type is defined by the return type of the access mode's method.
accessMode
- the access mode, corresponding to the signature-polymorphic method of the same name public final boolean isAccessModeSupported(VarHandle.AccessMode accessMode)
true
if the given access mode is supported, otherwise false
.The return of a false
value for a given access mode indicates that an UnsupportedOperationException
is thrown on invocation of the corresponding access mode's signature-polymorphic method.
accessMode
- the access mode, corresponding to the signature-polymorphic method of the same name true
if the given access mode is supported, otherwise false
. public final MethodHandle toMethodHandle(VarHandle.AccessMode accessMode)
vh
and access mode {access-mode}
, returns a method handle that is equivalent to method handle bhm
in the following code (though it may be more efficient):
MethodHandle mh = MethodHandles.varHandleExactInvoker(
vh.accessModeType(VarHandle.AccessMode.{access-mode}));
MethodHandle bmh = mh.bindTo(vh);
accessMode
- the access mode, corresponding to the signature-polymorphic method of the same name public static void fullFence()
atomic_thread_fence(memory_order_seq_cst)
public static void acquireFence()
atomic_thread_fence(memory_order_acquire)
public static void releaseFence()
atomic_thread_fence(memory_order_release)
public static void loadLoadFence()
public static void storeStoreFence()
Submit a bug or feature
For further API reference and developer documentation, see Java SE Documentation . That documentation contains more detailed, developer-targeted descriptions, with conceptual overviews, definitions of terms, workarounds, and working code examples.
Copyright © 1993, 2017, Oracle and/or its affiliates. 500 Oracle Parkway
Redwood Shores, CA 94065 USA. All rights reserved.
DRAFT 9-ea+159
© 2017 Oracle Corporation and/or its affiliates