public interface LockCodecTemplate
| Modifier and Type | Method and Description |
|---|---|
void |
forceUnlock(String name,
long referenceId)
Releases the lock regardless of the lock owner.
|
Object |
getLockCount(String name)
Returns re-entrant lock hold count, regardless of lock ownership.
|
Object |
getRemainingLeaseTime(String name)
Returns remaining lease time in milliseconds.
|
Object |
isLocked(String name)
Returns whether this lock is locked or not.
|
Object |
isLockedByCurrentThread(String name,
long threadId)
Returns whether this lock is locked by current thread or not.
|
void |
lock(String name,
long leaseTime,
long threadId,
long referenceId)
Acquires the lock for the specified lease time.After lease time, lock will be released.If the lock is not
available then the current thread becomes disabled for thread scheduling purposes and lies dormant until the lock
has been acquired.
|
Object |
tryLock(String name,
long threadId,
long lease,
long timeout,
long referenceId)
Tries to acquire the lock for the specified lease time.After lease time, the lock will be released.
|
void |
unlock(String name,
long threadId,
long referenceId)
Releases the lock.
|
Object isLocked(String name)
name - Name of the LockObject isLockedByCurrentThread(String name, long threadId)
name - Name of the LockthreadId - The id of the user thread performing the operation. It is used to guarantee that only the lock holder thread (if a lock exists on the entry) can perform the requested operation.Object getLockCount(String name)
name - Name of the LockObject getRemainingLeaseTime(String name)
name - Name of the Lockvoid lock(String name, long leaseTime, long threadId, @Since(value="1.2") long referenceId)
name - Name of the LockleaseTime - Time to wait before releasing to lockthreadId - The id of the user thread performing the operation. It is used to guarantee that only the lock holder thread (if a lock exists on the entry) can perform the requested operation.referenceId - The client-wide unique id for this request. It is used to make the request idempotent by sending the same reference id during retries.void unlock(String name, long threadId, @Since(value="1.2") long referenceId)
name - Name of the LockthreadId - The id of the user thread performing the operation. It is used to guarantee that only the lock holder thread (if a lock exists on the entry) can perform the requested operation.referenceId - The client-wide unique id for this request. It is used to make the request idempotent by sending the same reference id during retries.void forceUnlock(String name, @Since(value="1.2") long referenceId)
name - Name of the LockreferenceId - The client-wide unique id for this request. It is used to make the request idempotent by sending the same reference id during retries.Object tryLock(String name, long threadId, long lease, long timeout, @Since(value="1.2") long referenceId)
name - Name of the LockthreadId - The id of the user thread performing the operation. It is used to guarantee that only the lock holder thread (if a lock exists on the entry) can perform the requested operation.lease - time in milliseconds to wait before releasing the lock.timeout - Maximum time to wait for the lock.referenceId - The client-wide unique id for this request. It is used to make the request idempotent by sending the same reference id during retries.Copyright © 2018. All Rights Reserved.