* Dispatches a pooledResource to the next waiting client (if any) else * puts the PooledResource back on the available list * @param {PooledResource} pooledResource [description] * @return {Boolean} [description]
(pooledResource)
| 271 | * @return {Boolean} [description] |
| 272 | */ |
| 273 | _dispatchPooledResourceToNextWaitingClient(pooledResource) { |
| 274 | const clientResourceRequest = this._waitingClientsQueue.dequeue(); |
| 275 | if ( |
| 276 | clientResourceRequest === undefined || |
| 277 | clientResourceRequest.state !== Deferred.PENDING |
| 278 | ) { |
| 279 | // While we were away either all the waiting clients timed out |
| 280 | // or were somehow fulfilled. put our pooledResource back. |
| 281 | this._addPooledResourceToAvailableObjects(pooledResource); |
| 282 | // TODO: do need to trigger anything before we leave? |
| 283 | return false; |
| 284 | } |
| 285 | const loan = new ResourceLoan(pooledResource, this._Promise); |
| 286 | this._resourceLoans.set(pooledResource.obj, loan); |
| 287 | pooledResource.allocate(); |
| 288 | clientResourceRequest.resolve(pooledResource.obj); |
| 289 | return true; |
| 290 | } |
| 291 | |
| 292 | /** |
| 293 | * tracks on operation using given set |
no test coverage detected