Merge pull request #5820 from eclipse/jetty-9.4.x-5819-PoolArithmeticException

backport fix for ArithmeticException in Pool
This commit is contained in:
Ludovic Orban 2020-12-17 16:26:12 +01:00 committed by GitHub
commit d5648c73a1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
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;
}