Skip to content

Commit ecb04bb

Browse files
committed
GH-3826: Fix reducePermits
Must not go negative.
1 parent d3bf48c commit ecb04bb

File tree

1 file changed

+2
-1
lines changed
  • spring-integration-core/src/main/java/org/springframework/integration/util

1 file changed

+2
-1
lines changed

Diff for: spring-integration-core/src/main/java/org/springframework/integration/util/SimplePool.java

+2-1
Original file line numberDiff line numberDiff line change
@@ -272,6 +272,7 @@ public synchronized void close() {
272272
removeAllIdleItems();
273273
}
274274

275+
@SuppressWarnings("serial")
275276
private static class PoolSemaphore extends Semaphore {
276277

277278
PoolSemaphore(int permits) {
@@ -280,7 +281,7 @@ private static class PoolSemaphore extends Semaphore {
280281

281282
@Override
282283
public void reducePermits(int reduction) { // NOSONAR increases visibility
283-
super.reducePermits(reduction);
284+
super.reducePermits(reduction > availablePermits() ? availablePermits() : reduction);
284285
}
285286

286287
}

0 commit comments

Comments
 (0)