public class DistributedLockManager extends AbstractLockManager
LockManager which uses Hazelcast's distributed
MultiMap to store locks.
Example:
HazelcastInstance hz = ...; LockManager lm1 = new DistributedLockManager(hz, "distributed-byte-range-lock"); LockManager lm2 = new DistributedLockManager(hz, "distributed-byte-range-lock");The
lm1 and lm2 will share the same set of locks as long as they
connected to the same Hazelcast cluster.| Constructor and Description |
|---|
DistributedLockManager(com.hazelcast.core.HazelcastInstance hz,
String name)
Create a new
DistributedLockManager with a given name. |
| Modifier and Type | Method and Description |
|---|---|
protected void |
add(byte[] objId,
NlmLock lock) |
protected void |
addAll(byte[] objId,
Collection<NlmLock> locks) |
protected Collection<NlmLock> |
getActiveLocks(byte[] objId)
Get collection of currently used active locks on the object.
|
protected Lock |
getObjectLock(byte[] objId) |
protected boolean |
remove(byte[] objId,
NlmLock lock) |
protected void |
removeAll(byte[] objId,
Collection<NlmLock> locks) |
lock, test, unlock, unlockIfExistspublic DistributedLockManager(com.hazelcast.core.HazelcastInstance hz,
String name)
DistributedLockManager with a given name.
The other instances with the same name will share the same back-end store and,
as a result, will see the same set of locks.hz - reference to Haselcast instance.name - name of the lock manager.protected Lock getObjectLock(byte[] objId)
getObjectLock in class AbstractLockManagerprotected Collection<NlmLock> getActiveLocks(byte[] objId)
getActiveLocks in class AbstractLockManagerobjId - object id.protected void add(byte[] objId,
NlmLock lock)
add in class AbstractLockManagerprotected boolean remove(byte[] objId,
NlmLock lock)
remove in class AbstractLockManagerprotected void addAll(byte[] objId,
Collection<NlmLock> locks)
addAll in class AbstractLockManagerprotected void removeAll(byte[] objId,
Collection<NlmLock> locks)
removeAll in class AbstractLockManagerCopyright © 2018. All Rights Reserved.