Class KeyedLock<K>
java.lang.Object
com.cryptomorin.xseries.profiles.lock.KeyedLock<K>
- All Implemented Interfaces:
AutoCloseable
A lock associated to an object that keeps track of how many threads are
currently using this lock until none are left in which case it removes itself.
These locks should be registered in a
KeyedLockMap.-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected final Kprotected final Lockprotected intThis does not need to be volatile because access to this property is entirely synchronized (inKeyedLockMap) and no two threads will access this at the same time. -
Constructor Summary
Constructors -
Method Summary
-
Field Details
-
lock
-
key
-
pendingTasks
protected int pendingTasksThis does not need to be volatile because access to this property is entirely synchronized (inKeyedLockMap) and no two threads will access this at the same time.
-
-
Constructor Details
-
KeyedLock
-
-
Method Details
-
lock
public void lock() -
unlock
public void unlock() -
close
public void close()- Specified by:
closein interfaceAutoCloseable
-
toString
-