Options
All
  • Public
  • Public/Protected
  • All
Menu

Interface ILock

Hierarchy

Implemented by

Index

Methods

destroy

  • destroy(): Promise

forceUnlock

  • forceUnlock(): Promise
  • Forcefully unlocks the lock. Usually, the same client has to call unlock the same amount of times as the amount of times it has called lock, otherwise the lock will remain in locked state. This method will disregard the acquire count and release this lock immediately.

    Returns Promise

getLockCount

  • getLockCount(): Promise
  • Returns Promise

    the number of times this lock was acquired by its owner, i.e. how many times the unlock method should be invoked for the lock to become free.

getName

  • getName(): string

getPartitionKey

  • getPartitionKey(): string
  • Returns the key of the partition that this DistributedObject is assigned to. For a partitioned data structure, the returned value will not be null, but otherwise undefined.

    Returns string

getRemainingLeaseTime

  • getRemainingLeaseTime(): Promise
  • Returns Promise

    the number of milliseconds in which the lease for this lock will expire.

getServiceName

  • getServiceName(): string

isLocked

  • isLocked(): Promise
  • Returns Promise

    true if this lock is currently in the locked state, false otherwise.

isLockedByThisClient

  • isLockedByThisClient(): Promise
  • Returns Promise

    true if this lock is currently held by this client, false otherwise.

lock

  • lock(leaseMillis?: number): Promise
  • Acquires this lock, waiting indefinitely for it to become available. The returned promise will be resolved as soon as this lock is acquired. If lease time is specified then this lock will be held for the specified amount of time and then released automatically. Otherwise it will be held indefinitely up until the user invokes unlock.

    Parameters

    • Optional leaseMillis: number

      period of time in milliseconds for which this lock should be held.

    Returns Promise

tryLock

  • tryLock(timeoutMillis?: number, leaseMillis?: number): Promise
  • Tries to acquire this lock within a specified timeout. The returned promise will be resolved either when this lock is acquired or when timeout is reached. Setting timeout to -1 will make this method wait for the lock availability indefinitely. If lease time is specified then this lock will be held for the specified amount of time and then released automatically. Otherwise it will be held indefinitely up until the user invokes unlock.

    Parameters

    • Optional timeoutMillis: number

      period of time in milliseconds to wait for this lock to become available.

    • Optional leaseMillis: number

      period of time in milliseconds for which this lock should be held.

    Returns Promise

    true if this lock was obtained in the specified time period, false otherwise.

unlock

  • unlock(): Promise

Generated using TypeDoc