Acquires the lock for the specified key for the specified lease time.
Namespace: Hazelcast.CoreAssembly: Hazelcast.Net (in Hazelcast.Net.dll) Version: 3.6.2.0
void Lock(
TKey key,
long leaseTime,
TimeUnit timeUnit
)
Sub Lock (
key As TKey,
leaseTime As Long,
timeUnit As TimeUnit
)
void Lock(
TKey key,
long long leaseTime,
TimeUnit timeUnit
)
abstract Lock :
key : 'TKey *
leaseTime : int64 *
timeUnit : TimeUnit -> unit
Parameters
- key
- Type: TKey
key to lock. - leaseTime
- Type: SystemInt64
time to wait before releasing the lock. - timeUnit
- Type: Hazelcast.CoreTimeUnit
TimeUnit for the ttl
Acquires the lock for the specified key 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.
Scope of the lock is this map only.
Acquired lock is only for the key in this map.
Locks are re-entrant so if the key is locked N times then
it should be unlocked N times before another thread can acquire it.
Warning:
This method uses
GetHashCode and
Equals of binary form of
the
key, not the actual implementations of
GetHashCode and
Equals
defined in
key's class.
Reference