Class ReentrantWrappedStampedLock
java.lang.Object
com.fastasyncworldedit.core.concurrent.ReentrantWrappedStampedLock
- All Implemented Interfaces:
Lock
Allows for reentrant behaviour of a wrapped
StampedLock
. Will not count the number of times it is re-entered.- Since:
- 2.3.0
-
Constructor Summary
Constructors -
Method Summary
-
Constructor Details
-
ReentrantWrappedStampedLock
public ReentrantWrappedStampedLock()
-
-
Method Details
-
lock
public void lock() -
lockInterruptibly
- Specified by:
lockInterruptibly
in interfaceLock
- Throws:
InterruptedException
-
tryLock
public boolean tryLock() -
tryLock
- Specified by:
tryLock
in interfaceLock
- Throws:
InterruptedException
-
unlock
public void unlock() -
newCondition
- Specified by:
newCondition
in interfaceLock
-
getStampChecked
public long getStampChecked()Retrieves the stamp associated with the current lock. 0 if the wrappedStampedLock
is not write-locked. This method is thread-checking.- Returns:
- lock stam[ or 0 if not locked.
- Throws:
IllegalCallerException
- if theStampedLock
is write-locked and the calling thread is not the lock owner- Since:
- 2.3.0
-
unlock
public void unlock(long stamp) Unlock the wrappedStampedLock
using the given stamp. This can be called by any thread.- Parameters:
stamp
- Stamp to unlock with- Throws:
IllegalMonitorStateException
- if the given stamp does not match the lock's stamp- Since:
- 2.3.0
-
isLocked
public boolean isLocked()Returns true if the lock is currently held.- Returns:
- true if the lock is currently held.
- Since:
- 2.3.0
-