ResourcePool

ResourcePool

Class for resource pool

Constructor

new ResourcePool(construct, maxResources)

Source:

Constructor

Parameters:
Name Type Description
construct function

resource constructor

maxResources number

maximal amount of resources

Methods

canBeTerminated() → {boolean}

Source:

cann be terminated

Returns:

true - if pool is empty or termination allowed

Type
boolean

canRun() → {boolean}

Source:

Check if there are any resources in the pool available

Returns:

if any available

Type
boolean

close() → {Promise}

Source:

Close resourse

Returns:

promise

Type
Promise

getResource() → {object}

Source:

Get a free resource

Returns:

resource to use

Type
object

kill() → {Promise}

Source:

Kill resourse

Returns:

promise

Type
Promise