Class LockFromLockStore
java.lang.Object
org.aksw.commons.lock.db.impl.LockFromLockStore
- All Implemented Interfaces:
ReadWriteLock, ReadWriteLockWithOwnership
A
ReadWriteLock implementation that coordinates acquisition of
the management lock and subsequent modification of the read/write lock states.- Author:
- raven
-
Nested Class Summary
Nested Classes -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected LockFromLinkprotected Durationprotected Stringprotected LockFromLinkprotected Lockprotected ResourceLock<String> protected LockFromLinkprotected Lock -
Constructor Summary
ConstructorsConstructorDescriptionLockFromLockStore(ResourceLock<String> resourceLock, String ownerKey, LockFromLink mgmtLock, LockFromLink readLock, LockFromLink writeLock) -
Method Summary
Modifier and TypeMethodDescriptionbooleancheckIfLockingIsNeeded(boolean write) protected booleanlock(boolean write) protected booleanlockCore(boolean write) booleanbooleanreadLock()voidunlock()protected voidunlock(boolean write) protected voidunlockCore(boolean write) Methods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface ReadWriteLockWithOwnership
isLockedHere
-
Field Details
-
resourceLock
-
mgmtLockTtl
-
ownerKey
-
mgmtLock
-
readLock
-
writeLock
-
readLockView
-
writeLockView
-
-
Constructor Details
-
LockFromLockStore
public LockFromLockStore(ResourceLock<String> resourceLock, String ownerKey, LockFromLink mgmtLock, LockFromLink readLock, LockFromLink writeLock)
-
-
Method Details
-
readLock
- Specified by:
readLockin interfaceReadWriteLock
-
writeLock
- Specified by:
writeLockin interfaceReadWriteLock
-
ownsReadLock
public boolean ownsReadLock()- Specified by:
ownsReadLockin interfaceReadWriteLockWithOwnership
-
ownsWriteLock
public boolean ownsWriteLock()- Specified by:
ownsWriteLockin interfaceReadWriteLockWithOwnership
-
getMgmtLock
- Specified by:
getMgmtLockin interfaceReadWriteLockWithOwnership
-
checkIfLockingIsNeeded
public boolean checkIfLockingIsNeeded(boolean write) -
lock
protected boolean lock(boolean write) -
lockCore
protected boolean lockCore(boolean write) -
unlock
protected void unlock(boolean write) -
unlockCore
protected void unlockCore(boolean write) -
unlock
public void unlock()
-