public final class LockStoreImpl extends Object implements IdentifiedDataSerializable, LockStore, Versioned
| Constructor and Description |
|---|
LockStoreImpl() |
LockStoreImpl(LockService lockService,
ObjectNamespace name,
EntryTaskScheduler<Data,Integer> entryTaskScheduler,
int backupCount,
int asyncBackupCount) |
| Modifier and Type | Method and Description |
|---|---|
void |
addAwait(Data key,
String conditionId,
String caller,
long threadId) |
boolean |
canAcquireLock(Data key,
String caller,
long threadId)
Return if the key can be locked by the caller and thread ID.
|
void |
clear() |
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 |
getAsyncBackupCount() |
int |
getBackupCount() |
int |
getFactoryId()
Returns DataSerializableFactory factory ID for this class.
|
int |
getId()
Returns type identifier for this class.
|
com.hazelcast.concurrent.lock.LockResourceImpl |
getLock(Data key) |
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.
|
Collection<LockResource> |
getLocks() |
ObjectNamespace |
getNamespace() |
WaitNotifyKey |
getNotifiedKey(Data key) |
String |
getOwnerInfo(Data key)
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.
|
int |
getTotalBackupCount() |
int |
getVersion(Data key) |
boolean |
hasLock() |
boolean |
hasSignalKey(ConditionKey conditionKey) |
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.
|
AwaitOperation |
pollExpiredAwaitOp(Data key) |
void |
readData(ObjectDataInput in)
Reads fields from the input stream
|
void |
registerExpiredAwaitOp(AwaitOperation awaitResponse) |
void |
removeAwait(Data key,
String conditionId,
String caller,
long threadId) |
void |
removeLocalLocks() |
void |
removeSignalKey(ConditionKey conditionKey) |
boolean |
shouldBlockReads(Data key)
Return whether the reads for the specific key should be blocked
(see
LockStore.txnLock(Data, String, long, long, long, boolean)). |
void |
signal(Data key,
String conditionId,
int maxSignalCount,
String objectName) |
String |
toString() |
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.
|
void |
writeData(ObjectDataOutput out)
Writes object fields to output stream
|
public LockStoreImpl()
public LockStoreImpl(LockService lockService, ObjectNamespace name, EntryTaskScheduler<Data,Integer> entryTaskScheduler, int backupCount, int asyncBackupCount)
public boolean lock(Data key, String caller, long threadId, long referenceId, long leaseTime)
LockStorelock in interface LockStorekey - 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)
LockStorelocalLock in interface LockStorekey - 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_SECONDSpublic boolean txnLock(Data key, String caller, long threadId, long referenceId, long leaseTime, boolean blockReads)
LockStoretxnLock in interface LockStorekey - 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)
LockStoreextendLeaseTime in interface LockStorekey - 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 com.hazelcast.concurrent.lock.LockResourceImpl getLock(Data key)
public boolean isLocked(Data key)
LockStorepublic boolean isLockedBy(Data key, String caller, long threadId)
LockStoreisLockedBy in interface LockStorekey - the locked keycaller - the identifier for the callerthreadId - the identifier for the thread on the callerpublic int getLockCount(Data key)
LockStoregetLockCount in interface LockStorekey - the keypublic int getLockedEntryCount()
LockStoregetLockedEntryCount in interface LockStorepublic long getRemainingLeaseTime(Data key)
LockStoregetRemainingLeaseTime in interface LockStorekey - the keypublic boolean canAcquireLock(Data key, String caller, long threadId)
LockStorecanAcquireLock in interface LockStorekey - the locked keycaller - the identifier for the callerthreadId - the identifier for the thread on the callerpublic boolean shouldBlockReads(Data key)
LockStoreLockStore.txnLock(Data, String, long, long, long, boolean)).shouldBlockReads in interface LockStorekey - the lock keypublic boolean unlock(Data key, String caller, long threadId, long referenceId)
LockStorepublic boolean forceUnlock(Data key)
LockStoretrue if the key is already unlocked but has
waiters/signals/expired operations.forceUnlock in interface LockStorekey - the lock keyfalse if there is no lock for the given key and true otherwisepublic int getVersion(Data key)
public Collection<LockResource> getLocks()
public void removeLocalLocks()
public Set<Data> getLockedKeys()
LockStoregetLockedKeys in interface LockStorepublic boolean hasLock()
public void clear()
public ObjectNamespace getNamespace()
public int getBackupCount()
public int getAsyncBackupCount()
public int getTotalBackupCount()
public WaitNotifyKey getNotifiedKey(Data key)
public void removeSignalKey(ConditionKey conditionKey)
public boolean hasSignalKey(ConditionKey conditionKey)
public void registerExpiredAwaitOp(AwaitOperation awaitResponse)
public AwaitOperation pollExpiredAwaitOp(Data key)
public String getOwnerInfo(Data key)
LockStoregetOwnerInfo in interface LockStorekey - the keypublic int getFactoryId()
IdentifiedDataSerializablegetFactoryId in interface IdentifiedDataSerializablepublic int getId()
IdentifiedDataSerializablegetId in interface IdentifiedDataSerializablepublic void writeData(ObjectDataOutput out) throws IOException
DataSerializablewriteData in interface DataSerializableout - outputIOException - if an I/O error occurs. In particular,
an IOException may be thrown if the
output stream has been closed.public void readData(ObjectDataInput in) throws IOException
DataSerializablereadData in interface DataSerializablein - inputIOException - if an I/O error occurs. In particular,
an IOException may be thrown if the
input stream has been closed.Copyright © 2018 Hazelcast, Inc.. All Rights Reserved.