* @private
()
| 315 | * @private |
| 316 | */ |
| 317 | _createResource() { |
| 318 | // An attempt to create a resource |
| 319 | const factoryPromise = this._factory.create(); |
| 320 | const wrappedFactoryPromise = this._Promise |
| 321 | .resolve(factoryPromise) |
| 322 | .then(resource => { |
| 323 | const pooledResource = new PooledResource(resource); |
| 324 | this._allObjects.add(pooledResource); |
| 325 | this._addPooledResourceToAvailableObjects(pooledResource); |
| 326 | }); |
| 327 | |
| 328 | this._trackOperation(wrappedFactoryPromise, this._factoryCreateOperations) |
| 329 | .then(() => { |
| 330 | this._dispense(); |
| 331 | // Stop bluebird complaining about this side-effect only handler |
| 332 | // - a promise was created in a handler but was not returned from it |
| 333 | // https://goo.gl/rRqMUw |
| 334 | return null; |
| 335 | }) |
| 336 | .catch(reason => { |
| 337 | this.emit(FACTORY_CREATE_ERROR, reason); |
| 338 | this._dispense(); |
| 339 | }); |
| 340 | } |
| 341 | |
| 342 | /** |
| 343 | * @private |
no test coverage detected