Class OOneEntryPerKeyLockManager<T>
java.lang.Object
com.orientechnologies.common.concur.lock.OOneEntryPerKeyLockManager<T>
- Type Parameters:
T- Type of keys
- All Implemented Interfaces:
OLockManager<T>
Original Lock Manager implementation that uses a concurrent linked hash map to store one entry
per key. This could be very expensive in case the number of locks are a lot.
- Author:
- Luca Garulli (l.garulli--(at)--orientdb.com)
-
Nested Class Summary
Nested Classes -
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionOOneEntryPerKeyLockManager(boolean iEnabled, int iAcquireTimeout, int amountOfCachedInstances) OOneEntryPerKeyLockManager(boolean iEnabled, int iAcquireTimeout, int concurrencyLevel, int amountOfCachedInstances) -
Method Summary
Modifier and TypeMethodDescriptionacquireExclusiveLock(T key) Lock[]acquireExclusiveLocksInBatch(Collection<T> values) Lock[]acquireExclusiveLocksInBatch(T... values) acquireLock(T iResourceId, OOneEntryPerKeyLockManager.LOCK iLockType) acquireLock(T iResourceId, OOneEntryPerKeyLockManager.LOCK iLockType, long iTimeout) protected Lock[]acquireLockInBatch(T[] values, boolean exclusiveMode) acquireSharedLock(T key) Lock[]acquireSharedLocksInBatch(T... values) intprotected TgetImmutableResourceId(T iResourceId) voidreleaseExclusiveLock(T key) voidreleaseLock(Object iRequester, T iResourceId, OOneEntryPerKeyLockManager.LOCK iLockType) voidreleaseSharedLock(T key)
-
Field Details
-
map
protected final com.googlecode.concurrentlinkedhashmap.ConcurrentLinkedHashMap<T,com.orientechnologies.common.concur.lock.OOneEntryPerKeyLockManager.CountableLock> map
-
-
Constructor Details
-
OOneEntryPerKeyLockManager
public OOneEntryPerKeyLockManager(boolean iEnabled, int iAcquireTimeout, int amountOfCachedInstances) -
OOneEntryPerKeyLockManager
public OOneEntryPerKeyLockManager(boolean iEnabled, int iAcquireTimeout, int concurrencyLevel, int amountOfCachedInstances)
-
-
Method Details
-
acquireExclusiveLock
- Specified by:
acquireExclusiveLockin interfaceOLockManager<T>
-
releaseExclusiveLock
- Specified by:
releaseExclusiveLockin interfaceOLockManager<T>
-
acquireLock
-
acquireLock
-
releaseLock
public void releaseLock(Object iRequester, T iResourceId, OOneEntryPerKeyLockManager.LOCK iLockType) throws OLockException - Throws:
OLockException
-
acquireExclusiveLocksInBatch
- Specified by:
acquireExclusiveLocksInBatchin interfaceOLockManager<T>
-
acquireExclusiveLocksInBatch
- Specified by:
acquireExclusiveLocksInBatchin interfaceOLockManager<T>
-
getCountCurrentLocks
public int getCountCurrentLocks() -
getImmutableResourceId
-
acquireLockInBatch