.NET Client Documentation
5.1.1
Search Results for

    Show / Hide Table of Contents

    TryLockAndGetFenceAsync Method

    TryLockAndGetFenceAsync(LockContext, TimeSpan)

    Tries to acquire the lock and return the fencing token assigned to the specified lockContext context for this lock acquisition.

    Declaration
    Task<long> TryLockAndGetFenceAsync(LockContext lockContext, TimeSpan timeout)
    Parameters
    LockContext lockContext

    The LockContext.

    TimeSpan timeout

    The maximum time to wait for the lock.

    Returns
    Task<Int64>

    The fencing token if the lock was acquired; otherwise InvalidFence.

    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 the fencing token assigned to this acquisition. If the lock is not immediately available, the method immediately returns InvalidFence representing a failed lock attempt.

    TryLockAndGetFenceAsync(LockContext)

    Tries to acquire the lock and return the fencing token assigned to the specified lockContext context for this lock acquisition.

    Declaration
    Task<long> TryLockAndGetFenceAsync(LockContext lockContext)
    Parameters
    LockContext lockContext

    The LockContext.

    Returns
    Task<Int64>

    The fencing token if the lock was acquired; otherwise InvalidFence.

    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 the fencing token assigned to this acquisition. If the lock is not immediately available, the method immediately returns InvalidFence representing a failed lock attempt.

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