We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 1da3a33 commit ee5328dCopy full SHA for ee5328d
1 file changed
src/main/java/com/zaxxer/hikari/util/ConcurrentBag.java
@@ -187,11 +187,11 @@ public void requite(final T bagEntry)
187
{
188
bagEntry.setState(STATE_NOT_IN_USE);
189
190
- for (var i = 0; waiters.get() > 0; i++) {
+ for (int i = 1, waiting = waiters.get(); waiting > 0; i++, waiting = waiters.get()) {
191
if (bagEntry.getState() != STATE_NOT_IN_USE || handoffQueue.offer(bagEntry)) {
192
return;
193
}
194
- else if ((i & 0xff) == 0xff) {
+ else if ((i & 0xff) == 0xff || (waiting > 1 && i % waiting == 0)) {
195
parkNanos(MICROSECONDS.toNanos(10));
196
197
else {
0 commit comments