Constructor
new ResourcePool(construct, maxResources)
- Description:
Constructor
- Source:
Parameters:
| Name | Type | Description |
|---|---|---|
construct |
function | resource constructor |
maxResources |
number | maximal amount of resources |
Methods
canBeTerminated() → {boolean}
- Description:
cann be terminated
- Source:
Returns:
true - if pool is empty or termination allowed
- Type
- boolean
canRun() → {boolean}
- Description:
Check if there are any resources in the pool available
- Source:
Returns:
if any available
- Type
- boolean
close() → {Promise}
- Description:
Close resourse
- Source:
Returns:
promise
- Type
- Promise
getResource() → {object}
- Description:
Get a free resource
- Source:
Returns:
resource to use
- Type
- object
kill() → {Promise}
- Description:
Kill resourse
- Source:
Returns:
promise
- Type
- Promise