removed explicit use of iterator

pull/502/head
Nitin 9 years ago
parent 54cd9d9685
commit 4b2e1d9ea5

@ -20,7 +20,6 @@ import java.sql.Connection;
import java.sql.SQLException;
import java.sql.SQLTransientConnectionException;
import java.util.Collections;
import java.util.Iterator;
import java.util.List;
import java.util.concurrent.Callable;
import java.util.concurrent.ExecutorService;
@ -616,15 +615,14 @@ public class HikariPool extends PoolBase implements HikariPoolMXBean, IBagStateL
if (removable > 0) {
// Sort pool entries on lastAccessed
Collections.sort(idleList, LASTACCESS_COMPARABLE);
// Iterate the first N removable elements
final Iterator<PoolEntry> iter = idleList.iterator();
do {
final PoolEntry poolEntry = iter.next();
for (PoolEntry poolEntry : idleList) {
if (clockSource.elapsedMillis(poolEntry.lastAccessed, now) > idleTimeout && connectionBag.reserve(poolEntry)) {
closeConnection(poolEntry, "(connection passed idleTimeout)");
removable--;
if (--removable == 0) {
break; // keep min idle cons
};
}
} while (removable > 0 && iter.hasNext());
}
}
}

Loading…
Cancel
Save