Skip to content

Commit

Permalink
Do not proceed with the resource delivery if Borrower is cancelled (#265
Browse files Browse the repository at this point in the history
)

Signed-off-by: Violeta Georgieva <[email protected]>
  • Loading branch information
violetagg authored Jan 8, 2025
1 parent 2005ac9 commit 9e5d4c3
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions reactor-pool/src/main/java/reactor/pool/SimpleDequePool.java
Original file line number Diff line number Diff line change
Expand Up @@ -358,7 +358,7 @@ private void drainLoop() {
continue;
}
Borrower<POOLABLE> borrower = pendingPoll(borrowers);
if (borrower == null) {
if (borrower == null || borrower.get()) {
if (idleResourceLeastRecentlyUsed) {
resources.offerFirst(slot);
}
Expand All @@ -367,6 +367,7 @@ private void drainLoop() {
}
incrementIdle();
//we expect to detect a disposed pool in the next round
//or the Borrower was cancelled
continue;
}
if (isDisposed()) {
Expand Down Expand Up @@ -413,8 +414,8 @@ private void drainLoop() {
* ... and CAN ALLOCATE => Subscribe to allocator + Warmup *
*=======================*/
Borrower<POOLABLE> borrower = pendingPoll(borrowers);
if (borrower == null) {
continue; //we expect to detect pool is shut down in next round
if (borrower == null || borrower.get()) {
continue; //we expect to detect pool is shut down in next round or the Borrower was cancelled
}
if (isDisposed()) {
borrower.fail(new PoolShutdownException());
Expand Down

0 comments on commit 9e5d4c3

Please sign in to comment.