public interface LockStore
key
.Modifier and Type | Method and Description |
---|---|
boolean |
canAcquireLock(Data key,
String caller,
long threadId)
Return if the key can be locked by the caller and thread ID.
|
boolean |
extendLeaseTime(Data key,
String caller,
long threadId,
long leaseTime)
Extend the lease time for an already locked key.
|
boolean |
forceUnlock(Data dataKey)
Unlock the key regardless of the owner.
|
int |
getLockCount(Data key)
Return the number of times a key was locked by the same owner (re-entered).
|
int |
getLockedEntryCount()
Return the number of locks this store holds.
|
Set<Data> |
getLockedKeys()
Return all locked keys for this store.
|
String |
getOwnerInfo(Data dataKey)
Return a string representation of the owner of the lock for a specific key.
|
long |
getRemainingLeaseTime(Data key)
Return the remaining lease time for a specific key.
|
boolean |
isLocked(Data key)
Check if a key is locked by any caller and thread ID.
|
boolean |
isLockedBy(Data key,
String caller,
long threadId)
Check if a key is locked by a specific caller and thread ID.
|
boolean |
localLock(Data key,
String caller,
long threadId,
long referenceId,
long leaseTime)
Lock a specific key on a local partition only.
|
boolean |
lock(Data key,
String caller,
long threadId,
long referenceId,
long leaseTime)
Lock a specific key.
|
boolean |
shouldBlockReads(Data key)
Return whether the reads for the specific key should be blocked
(see
txnLock(Data, String, long, long, long, boolean) ). |
boolean |
txnLock(Data key,
String caller,
long threadId,
long referenceId,
long leaseTime,
boolean blockReads)
Lock a specific key for use inside a transaction.
|
boolean |
unlock(Data key,
String caller,
long threadId,
long referenceId)
Unlock a specific key.
|
boolean lock(Data key, String caller, long threadId, long referenceId, long leaseTime)
key
- the key to lockcaller
- the identifier for the callerthreadId
- the identifier for the thread on the callerreferenceId
- the identifier for the invocation of the caller (e.g. operation call ID)leaseTime
- the lease duration in millisecondsboolean localLock(Data key, String caller, long threadId, long referenceId, long leaseTime)
key
- the key to lockcaller
- the identifier for the callerthreadId
- the identifier for the thread on the callerreferenceId
- the identifier for the invocation of the caller (e.g. operation call ID)leaseTime
- the lease duration in millisecondsGroupProperty.LOCK_MAX_LEASE_TIME_SECONDS
boolean txnLock(Data key, String caller, long threadId, long referenceId, long leaseTime, boolean blockReads)
key
- the key to lockcaller
- the identifier for the callerthreadId
- the identifier for the thread on the callerreferenceId
- the identifier for the invocation of the caller (e.g. operation call ID)leaseTime
- the lease duration in millisecondsblockReads
- whether reads for the key should be blocked (e.g. for map and multimap)boolean extendLeaseTime(Data key, String caller, long threadId, long leaseTime)
key
- the locked keycaller
- the identifier for the callerthreadId
- the identifier for the thread on the callerleaseTime
- time in milliseconds for the lease to be extendedboolean unlock(Data key, String caller, long threadId, long referenceId)
key
- the locked keycaller
- the identifier for the callerthreadId
- the identifier for the thread on the callerreferenceId
- the identifier for the invocation of the caller (e.g. operation call ID)boolean isLocked(Data key)
key
- the keyboolean isLockedBy(Data key, String caller, long threadId)
key
- the locked keycaller
- the identifier for the callerthreadId
- the identifier for the thread on the callerint getLockCount(Data key)
key
- the keyint getLockedEntryCount()
long getRemainingLeaseTime(Data key)
key
- the keyboolean canAcquireLock(Data key, String caller, long threadId)
key
- the locked keycaller
- the identifier for the callerthreadId
- the identifier for the thread on the callerboolean shouldBlockReads(Data key)
txnLock(Data, String, long, long, long, boolean)
).key
- the lock keySet<Data> getLockedKeys()
boolean forceUnlock(Data dataKey)
true
if the key is already unlocked but has
waiters/signals/expired operations.dataKey
- the lock keyfalse
if there is no lock for the given key
and true
otherwiseCopyright © 2018 Hazelcast, Inc.. All Rights Reserved.