public final class AccessFlag
extends java.lang.Object
| Constructor and Description |
|---|
AccessFlag() |
AccessFlag(boolean locked) |
AccessFlag(boolean locked,
java.util.function.Supplier<java.lang.RuntimeException> exceptionSupplier) |
AccessFlag(java.lang.String name) |
AccessFlag(java.lang.String name,
boolean locked) |
| Modifier and Type | Method and Description |
|---|---|
boolean |
isLocked() |
void |
lock() |
void |
lockWhile(java.lang.Runnable runnable)
Tests if the access is locked.
|
void |
test()
Tests if the access is locked.
|
void |
testAndLock()
Tests if the access is locked.
|
void |
toggleLock() |
void |
unlock() |
public AccessFlag()
public AccessFlag(java.lang.String name)
public AccessFlag(boolean locked)
public AccessFlag(java.lang.String name,
boolean locked)
public AccessFlag(boolean locked,
java.util.function.Supplier<java.lang.RuntimeException> exceptionSupplier)
public void lock()
public void unlock()
public void toggleLock()
public boolean isLocked()
public void test()
IllegalStateException.public void testAndLock()
IllegalStateException. If it is unlocked, it will be locked.public void lockWhile(java.lang.Runnable runnable)
Runnable and then unlocks.
If it is locked an exception is thrown. By default this is an
IllegalStateException.
If the runnable throws an exception, the lock will not
be lifted!runnable - the runnable to execute during the locked periodCopyright © 2018. All Rights Reserved.