BAEL-1818 lamdba instead of loop; isEmpty() instead of == 0 (#4791)
This commit is contained in:
parent
0be7aa087f
commit
e14abbfb58
|
@ -33,7 +33,7 @@ public class BasicConnectionPool implements ConnectionPool {
|
|||
|
||||
@Override
|
||||
public Connection getConnection() throws SQLException {
|
||||
if (connectionPool.size() == 0) {
|
||||
if (connectionPool.isEmpty()) {
|
||||
if (usedConnections.size() < MAX_POOL_SIZE) {
|
||||
connectionPool.add(createConnection(url, user, password));
|
||||
} else {
|
||||
|
@ -76,9 +76,7 @@ public class BasicConnectionPool implements ConnectionPool {
|
|||
}
|
||||
|
||||
public void shutdown() throws SQLException {
|
||||
for (Connection c : usedConnections) {
|
||||
this.releaseConnection(c);
|
||||
}
|
||||
usedConnections.forEach(this::releaseConnection);
|
||||
for (Connection c : connectionPool) {
|
||||
c.close();
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue