fix ArithmeticException "/ by zero"

Signed-off-by: Ludovic Orban <lorban@bitronix.be>
This commit is contained in:
Ludovic Orban 2020-11-26 08:59:44 +01:00
parent 741ad918e4
commit b4483d3b2a
1 changed files with 5 additions and 0 deletions

View File

@ -249,6 +249,11 @@ public class Pool<T> implements AutoCloseable, Dumpable
{
LOGGER.trace("IGNORED", e);
size = entries.size();
// Size can be 0 when the pool is in the middle of
// acquiring a connection while another thread
// removes the last one from the pool.
if (size == 0)
break;
}
index = (index + 1) % size;
}