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 ExtendedLockPromise
acquire(Object key, Object lockOwner, long time, TimeUnit timeUnit)
void
deadlockCheck(DeadlockChecker deadlockChecker)
It forces a deadlock checks in all existing locks.InfinispanLock
getLock(Object key)
int
getNumLocksHeld()
void
inject(Executor executor, org.infinispan.commons.time.TimeService timeService)
boolean
isLocked(Object key)
void
release(Object key, Object lockOwner)
int
size()
String
toString()
-
-
-
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:
acquire
in 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:
getLock
in 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:
release
in interfaceLockContainer
-
getNumLocksHeld
public int getNumLocksHeld()
- Specified by:
getNumLocksHeld
in interfaceLockContainer
- Returns:
- number of locks held
-
isLocked
public boolean isLocked(Object key)
- Specified by:
isLocked
in interfaceLockContainer
- Parameters:
key
- the key to test.- Returns:
true
if the key is locked,false
otherwise.
-
size
public int size()
- Specified by:
size
in interfaceLockContainer
- Returns:
- the size of the shared lock pool
-
deadlockCheck
public void deadlockCheck(DeadlockChecker deadlockChecker)
Description copied from interface:LockContainer
It forces a deadlock checks in all existing locks.- Specified by:
deadlockCheck
in interfaceLockContainer
-
-