review comment: improve readability

Signed-off-by: Ludovic Orban <lorban@bitronix.be>
This commit is contained in:
Ludovic Orban 2021-05-18 11:08:26 +02:00
parent 593f4225f8
commit b7b16a880b
1 changed files with 6 additions and 3 deletions

View File

@ -462,13 +462,16 @@ public class Pool<T> implements AutoCloseable, Dumpable
for (Entry entry : copy)
{
boolean removed = entry.tryRemove();
if (!removed)
if (removed)
{
if (entry.pooled instanceof Closeable)
IO.close((Closeable)entry.pooled);
}
else
{
if (LOGGER.isDebugEnabled())
LOGGER.debug("Pooled object still in use: {}", entry);
}
if (removed && entry.pooled instanceof Closeable)
IO.close((Closeable)entry.pooled);
}
}