fix ArithmeticException "/ by zero"
Signed-off-by: Ludovic Orban <lorban@bitronix.be>
This commit is contained in:
parent
741ad918e4
commit
b4483d3b2a
|
@ -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;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue