.NET Client Documentation
5.1.1
Search Results for

    Show / Hide Table of Contents

    TryLockAsync Method

    TryLockAsync(LockContext, TimeSpan)

    Tries to acquire the lock for the specified lockContext context.

    Declaration
    Task<bool> TryLockAsync(LockContext lockContext, TimeSpan timeout)
    Parameters
    LockContext lockContext

    The LockContext.

    TimeSpan timeout

    The maximum time to wait for the lock.

    Returns
    Task<Boolean>

    true if the lock was acquired; otherwise false.

    Remarks

    If the lock is available or already held by the current specified lockContext at the time of invocation and the acquisition limit is not exceeded, the method immediately returns true. If the lock is not immediately available, the method waits for the specified timeout, and eventually returns false.

    TryLockAsync(LockContext)

    Tries to acquire the lock for the specified lockContext context.

    Declaration
    Task<bool> TryLockAsync(LockContext lockContext)
    Parameters
    LockContext lockContext

    The LockContext.

    Returns
    Task<Boolean>

    true if the lock was acquired; otherwise false.

    Remarks

    If the lock is available or already held by the current specified lockContext at the time of invocation and the acquisition limit is not exceeded, the method immediately returns true. If the lock is not immediately available, the method immediately returns false.

    In This Article
    Back to top Copyright © 2010-2022 Hazelcast, Inc. All rights reserved.
    Generated by DocFX.