Class ConcurrentResourcePool<TResource>

Type Parameters

  • TResource

Hierarchy

  • ConcurrentResourcePool

Constructors

Methods

  • Waits for a resource to have capacity and obtains a lease on that resource, creating a resource if necessary.

    If this operation times out or rejects, the lease is automatically released.

    Parameters

    • Optional options: ActionOptions

      The options for this individual .acquire invocation.

    Returns Promise<ResourceLease<TResource>>

    A lease on a pool resouce.

  • Shutdown the pool. Start (and await) the destruction of all resources. All leases are expired in the process.

    Returns Promise<void>

    void

  • Waits for the resource to be cleaned up (if necessary) and returns the lease to the pool.

    If this operation times out or rejects, the lease is still released.

    Parameters

    • externalLease: ResourceLease<TResource>

      The lease obtained by .acquire

    • Optional options: ActionOptions

      The options for this individual .release invocation.

    Returns Promise<void>

    void

  • Immediately retire the resource associated with a lease and release the lease.

    Parameters

    • externalLease: ResourceLease<TResource>

      The lease obtained by .acquire

    • Optional options: ActionOptions

      The options for this individual .retire invocation.

    Returns Promise<void>

    void

Generated using TypeDoc