.NET Client Documentation
5.1.1
Search Results for

    Show / Hide Table of Contents

    LockAndGetFenceAsync Method

    LockAndGetFenceAsync(LockContext)

    Acquires the lock and returns the fencing token assigned to the specified lockContext context for this lock acquisition.

    Declaration
    Task<long> LockAndGetFenceAsync(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 acquired in a reentrant way, the same fencing token is returned, or the LockAsync(LockContext) call can throw Hazelcast.Exceptions.LockAcquireLimitReachedException if the lock acquisition limit is already reached.

    Fencing tokens are monotonic numbers that are incremented each time the lock switches from the free state to the acquired state. They are simply used for ordering lock holders. A lock holder can pass its fencing to the shared resource to fence off previous lock holders. When this resource receives an operation, it can validate the fencing token in the operation.

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