Documenti di Didattica
Documenti di Professioni
Documenti di Cultura
Dr Heinz M. Kabutz
heinz@javaspecialists.eu
What is StampedLock?
l Not reentrant
– This is not a feature
👍 👎
(5,5) (5,5)
(0,0) (0,0)
(5,0)
Using Java 8 Lambdas and StampedLock To Manage Thread Safety 8
Using AtomicReference
static {
try {
XY_HANDLE = MethodHandles.lookup().findVarHandle(
PositionVarHandlesNonBlocking.class,
"xy", double[].class);
} catch (ReflectiveOperationException e) {
throw new Error(e);
}
}
Note: Exact API
might still change
Using Java 8 Lambdas and StampedLock To Manage Thread Safety 17
Our StampedLockIdioms
Our StampedLockIdioms.conditionalWrite()
Conclusion