![](../icons/Hazelcast-IMDG-Logo-Orange_Dark_200px.jpg) | IMultiMapTKey, TValueTryLock Method (TKey, Int64, TimeUnit) |
Tries to acquire the lock for the specified key.
Namespace:
Hazelcast.Core
Assembly:
Hazelcast.Net (in Hazelcast.Net.dll) Version: 3.9.4
Syntaxbool TryLock(
TKey key,
long time,
TimeUnit timeunit
)
Function TryLock (
key As TKey,
time As Long,
timeunit As TimeUnit
) As Boolean
bool TryLock(
TKey key,
long long time,
TimeUnit timeunit
)
abstract TryLock :
key : 'TKey *
time : int64 *
timeunit : TimeUnit -> bool
Parameters
- key
- Type: TKey
the key to lock - time
- Type: SystemInt64
the maximum time to wait for the lock - timeunit
- Type: Hazelcast.CoreTimeUnit
the time unit of the time argument.
Return Value
Type:
Booleantrue if the lock was acquired and
false
if the waiting time elapsed before the lock was acquired.
Exceptions
See Also