Constructor and Description |
---|
LockStoreProxy(LockStoreContainer container,
ObjectNamespace namespace) |
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 key)
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
LockStore.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.
|
public LockStoreProxy(LockStoreContainer container, ObjectNamespace namespace)
public boolean lock(Data key, String caller, long threadId, long referenceId, long leaseTime)
LockStore
lock
in interface LockStore
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 millisecondspublic boolean localLock(Data key, String caller, long threadId, long referenceId, long leaseTime)
LockStore
localLock
in interface LockStore
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
public boolean txnLock(Data key, String caller, long threadId, long referenceId, long leaseTime, boolean blockReads)
LockStore
txnLock
in interface LockStore
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)public boolean extendLeaseTime(Data key, String caller, long threadId, long leaseTime)
LockStore
extendLeaseTime
in interface LockStore
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 extendedpublic boolean unlock(Data key, String caller, long threadId, long referenceId)
LockStore
public boolean isLocked(Data key)
LockStore
public boolean isLockedBy(Data key, String caller, long threadId)
LockStore
isLockedBy
in interface LockStore
key
- the locked keycaller
- the identifier for the callerthreadId
- the identifier for the thread on the callerpublic int getLockCount(Data key)
LockStore
getLockCount
in interface LockStore
key
- the keypublic int getLockedEntryCount()
LockStore
getLockedEntryCount
in interface LockStore
public long getRemainingLeaseTime(Data key)
LockStore
getRemainingLeaseTime
in interface LockStore
key
- the keypublic boolean canAcquireLock(Data key, String caller, long threadId)
LockStore
canAcquireLock
in interface LockStore
key
- the locked keycaller
- the identifier for the callerthreadId
- the identifier for the thread on the callerpublic boolean shouldBlockReads(Data key)
LockStore
LockStore.txnLock(Data, String, long, long, long, boolean)
).shouldBlockReads
in interface LockStore
key
- the lock keypublic Set<Data> getLockedKeys()
LockStore
getLockedKeys
in interface LockStore
public boolean forceUnlock(Data key)
LockStore
true
if the key is already unlocked but has
waiters/signals/expired operations.forceUnlock
in interface LockStore
key
- the lock keypublic String getOwnerInfo(Data dataKey)
LockStore
getOwnerInfo
in interface LockStore
dataKey
- the keyCopyright © 2018 Hazelcast, Inc.. All Rights Reserved.