Skip to content

Commit b19b7f7

Browse files
committed
#23 - Refactor tidy - FreeConnectionBuffer
1 parent 16348a3 commit b19b7f7

File tree

1 file changed

+3
-8
lines changed

1 file changed

+3
-8
lines changed

src/main/java/io/ebean/datasource/pool/FreeConnectionBuffer.java

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -60,19 +60,14 @@ PooledConnection remove() {
6060
void closeAll(boolean logErrors) {
6161

6262
// create a temporary list
63-
List<PooledConnection> tempList = new ArrayList<>(freeBuffer.size());
64-
65-
// add all the connections into it
66-
tempList.addAll(freeBuffer);
63+
List<PooledConnection> tempList = new ArrayList<>(freeBuffer);
6764

6865
// clear the buffer (in case it takes some time to close these connections).
6966
freeBuffer.clear();
7067

7168
logger.debug("... closing all {} connections from the free list with logErrors: {}", tempList.size(), logErrors);
72-
for (int i = 0; i < tempList.size(); i++) {
73-
PooledConnection pooledConnection = tempList.get(i);
74-
logger.debug("... closing {} of {} connections from the free list", i, tempList.size());
75-
pooledConnection.closeConnectionFully(logErrors);
69+
for (PooledConnection connection : tempList) {
70+
connection.closeConnectionFully(logErrors);
7671
}
7772
}
7873

0 commit comments

Comments
 (0)