public interface LockCodecTemplate
Modifier and Type | Method and Description |
---|---|
void |
forceUnlock(String name)
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)
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)
Tries to acquire the lock for the specified lease time.After lease time, the lock will be released.
|
void |
unlock(String name,
long threadId)
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)
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.void unlock(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.void forceUnlock(String name)
name
- Name of the LockObject tryLock(String name, long threadId, long lease, long timeout)
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.Copyright © 2016 Hazelcast, Inc.. All Rights Reserved.