InstancePersistenceContext.BindReclaimedLock(Int64, TimeSpan) Method

Definition

Binds an existing lock on an instance to the current instance handle. The version of the existing lock is passed as a parameter.

public:
 void BindReclaimedLock(long instanceVersion, TimeSpan timeout);
public void BindReclaimedLock (long instanceVersion, TimeSpan timeout);
member this.BindReclaimedLock : int64 * TimeSpan -> unit
Public Sub BindReclaimedLock (instanceVersion As Long, timeout As TimeSpan)

Parameters

instanceVersion
Int64

Version of the lock held on the instance, or zero if the persistence provider does not implement lock versions.

timeout
TimeSpan

The time-out value for the operation.

Remarks

When attempting to acquire a lock, the persistence provider may decide that the current instance is already locked in the current store. If the lock token matches the current handle's lock token, then the persistence provider can attempt to reclaim the lock by inspecting its version and passing it to BindReclaimedLock. The persistence provider must not make changes to the instance until the lock is successfully reclaimed. If no other handle is bound to the lock, then BindReclaimedLock succeeds and the current handle becomes bound to the lock. Otherwise, BindReclaimedLock throws InstanceHandleConflictException. If commands are in progress on other handles, BindReclaimedLock may block waiting for the outcome of those commands before deciding whether the lock can be reclaimed.

The current instance handle must be bound to an instance and a lock owner. The instance must not be completed. The lock token associated with the lock owner is used to identify the owner of the lock.

Once a lock is bound to a handle, it remains bound for the lifetime of the handle. Neither the lock token nor the instance version can be changed.

Applies to