public enum MemoryOrderMode extends Enum<MemoryOrderMode>
| Enum Constant and Description |
|---|
ACQUIRE
ACQUIRE accesses are guaranteed to execute before all subsequent memory
accesses on the same thread. |
OPAQUE
OPAQUE accesses are similar to MemoryOrderMode.PLAIN accesses; they also do not have any
memory ordering guarantees. |
PLAIN
PLAIN accesses are "normal" Java memory operations. |
RELEASE
RELEASE accesses are guaranteed to execute after all prior memory accesses on
the same thread. |
RELEASE_ACQUIRE
RELEASE_ACQUIRE accesses are guaranteed to execute after all prior memory
access and before all subsequent memory accesses on the same thread. |
VOLATILE
The behavior of
VOLATILE is dependent on the type of access (load, store,
load&store):
Load: same ordering requirements as MemoryOrderMode.ACQUIRE
Store: same ordering requirements as MemoryOrderMode.RELEASE
Load&Store (i.e., atomic): same ordering requirements as MemoryOrderMode.RELEASE_ACQUIRE
In addition, all volatile accesses are strictly ordered. |
| Modifier and Type | Method and Description |
|---|---|
static MemoryOrderMode |
getMemoryOrder(ResolvedJavaField field) |
static boolean |
ordersMemoryAccesses(MemoryOrderMode memoryOrder) |
static MemoryOrderMode |
valueOf(String name)
Returns the enum constant of this type with the specified name.
|
static MemoryOrderMode[] |
values()
Returns an array containing the constants of this enum type, in
the order they are declared.
|
public static final MemoryOrderMode PLAIN
PLAIN accesses are "normal" Java memory operations. They do not have any memory
ordering guarantees.public static final MemoryOrderMode OPAQUE
OPAQUE accesses are similar to MemoryOrderMode.PLAIN accesses; they also do not have any
memory ordering guarantees. However, opaque writes are guaranteed to eventually become
visible to other threads.public static final MemoryOrderMode ACQUIRE
ACQUIRE accesses are guaranteed to execute before all subsequent memory
accesses on the same thread. However, they do not impose any ordering requirements on prior
memory accesses (prior memory accesses can be executed after a subsequent acquire).
Traditionally ACQUIREs are associated with loads.public static final MemoryOrderMode RELEASE
RELEASE accesses are guaranteed to execute after all prior memory accesses on
the same thread. However, they do not impose any ordering requirements on subsequent memory
accesses (subsequent memory accesses can be executed before a prior release). Traditionally
RELEASEs are associated with stores.public static final MemoryOrderMode RELEASE_ACQUIRE
RELEASE_ACQUIRE accesses are guaranteed to execute after all prior memory
access and before all subsequent memory accesses on the same thread. Traditionally
RELEASE_ACQUIREs are associated with atomic operations.public static final MemoryOrderMode VOLATILE
VOLATILE is dependent on the type of access (load, store,
load&store):
MemoryOrderMode.ACQUIREMemoryOrderMode.RELEASEMemoryOrderMode.RELEASE_ACQUIREpublic static MemoryOrderMode[] values()
public static MemoryOrderMode valueOf(String name)
name - the name of the enum constant to be returned.IllegalArgumentException - if this enum type has no constant with the specified nameNullPointerException - if the argument is nullpublic static boolean ordersMemoryAccesses(MemoryOrderMode memoryOrder)
public static MemoryOrderMode getMemoryOrder(ResolvedJavaField field)