public class VMMutex extends Object implements AutoCloseable
Lock.
It is not possible to allocate new VM mutexes at run time. All VM mutexes must be allocated
during image generation. They are initialized during startup of the VM, i.e., every VM mutex
consumes resources and contributes to VM startup time.
This class is almost an abstract base class for VMMutex. Sub-classes replace instances of VMMutex
with platform-specific implementations.| Modifier and Type | Class and Description |
|---|---|
static class |
VMMutex.TestingBackdoor |
| Modifier and Type | Field and Description |
|---|---|
protected boolean |
locked
For assertions about locking.
|
| Constructor and Description |
|---|
VMMutex() |
| Modifier and Type | Method and Description |
|---|---|
void |
assertIsLocked(String message) |
void |
assertIsNotLocked(String message) |
void |
close()
Releases the lock when locking using a try-with-resource statement.
|
void |
guaranteeIsLocked(String message) |
VMMutex |
lock()
Acquires the lock, with thread status transitions, blocking until the lock is available.
|
VMMutex |
lockNoTransition()
Like VMMutex.lock(), but without a thread status transitions.
|
void |
unlock()
Releases the lock.
|
void |
unlockWithoutChecks()
Releases the lock, without checking the result.
|
void |
warnIfNotLocked(String message) |
public VMMutex lock()
public VMMutex lockNoTransition()
public void unlock()
public void unlockWithoutChecks()
public final void close()
This is not annotated with Uninterruptible because using try-with-resources
implicitly calls Throwable.addSuppressed(Throwable), which I can not annotate.
close in interface AutoCloseablepublic final void assertIsLocked(String message)
public final void assertIsNotLocked(String message)
public final void warnIfNotLocked(String message)
public final void guaranteeIsLocked(String message)