Class PerKeyLockContainer
- java.lang.Object
-
- org.infinispan.util.concurrent.locks.impl.PerKeyLockContainer
-
- All Implemented Interfaces:
LockContainer
public class PerKeyLockContainer extends Object implements LockContainer
A lock container that creates and maintains a new lock per entry.- Since:
- 8.0
- Author:
- Pedro Ruivo
-
-
Constructor Summary
Constructors Constructor Description PerKeyLockContainer()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description ExtendedLockPromiseacquire(Object key, Object lockOwner, long time, TimeUnit timeUnit)voiddeadlockCheck(DeadlockChecker deadlockChecker)It forces a deadlock checks in all existing locks.InfinispanLockgetLock(Object key)intgetNumLocksHeld()voidinject(Executor executor, org.infinispan.commons.time.TimeService timeService)booleanisLocked(Object key)voidrelease(Object key, Object lockOwner)intsize()StringtoString()
-
-
-
Method Detail
-
inject
public void inject(Executor executor, org.infinispan.commons.time.TimeService timeService)
-
acquire
public ExtendedLockPromise acquire(Object key, Object lockOwner, long time, TimeUnit timeUnit)
- Specified by:
acquirein interfaceLockContainer- Parameters:
key- the key to lock.- Returns:
- the lock for a specific object to be acquired. If the lock does not exists, it is created.
-
getLock
public InfinispanLock getLock(Object key)
- Specified by:
getLockin interfaceLockContainer- Parameters:
key- the key to lock.- Returns:
- the lock for a specific object. If the lock does not exists, it return
null.
-
release
public void release(Object key, Object lockOwner)
- Specified by:
releasein interfaceLockContainer
-
getNumLocksHeld
public int getNumLocksHeld()
- Specified by:
getNumLocksHeldin interfaceLockContainer- Returns:
- number of locks held
-
isLocked
public boolean isLocked(Object key)
- Specified by:
isLockedin interfaceLockContainer- Parameters:
key- the key to test.- Returns:
trueif the key is locked,falseotherwise.
-
size
public int size()
- Specified by:
sizein interfaceLockContainer- Returns:
- the size of the shared lock pool
-
deadlockCheck
public void deadlockCheck(DeadlockChecker deadlockChecker)
Description copied from interface:LockContainerIt forces a deadlock checks in all existing locks.- Specified by:
deadlockCheckin interfaceLockContainer
-
-