backport fix for ArithmeticException

This commit is contained in:
Ludovic Orban 2020-12-17 14:16:42 +01:00
parent 38f0fc4c7f
commit 447823316d
1 changed files with 5 additions and 0 deletions

View File

@ -301,6 +301,11 @@ public class Pool<T> implements AutoCloseable, Dumpable
{
LOGGER.ignore(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;
}