Package org.axonframework.common.lock
Interface Lock
- All Superinterfaces:
AutoCloseable
- All Known Implementing Classes:
NoOpLock
Interface of a lock acquired to gain (exclusive) access to a shared resource, with a mechanism to release it again.
This lock is a
AutoCloseable resource, so will be released automatically if declared in a
try-with-resources block.- Since:
- 3.0
- Author:
- Rene de Waele
-
Method Summary
-
Method Details
-
close
default void close()Releases this lock. By default this simply callsrelease().- Specified by:
closein interfaceAutoCloseable
-
release
void release()Releases this lock. If this lock is already released or no longer valid, the behavior of this method is undefined. -
isHeld
boolean isHeld()Indicates whether the lock is still ownedtrue, or whether it has been releasedfalse.- Returns:
- true if the lock is still valid, or false if it has been released
-