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
|
@Override
|
||||||
public Connection getConnection() throws SQLException {
|
public Connection getConnection() throws SQLException {
|
||||||
if (connectionPool.size() == 0) {
|
if (connectionPool.isEmpty()) {
|
||||||
if (usedConnections.size() < MAX_POOL_SIZE) {
|
if (usedConnections.size() < MAX_POOL_SIZE) {
|
||||||
connectionPool.add(createConnection(url, user, password));
|
connectionPool.add(createConnection(url, user, password));
|
||||||
} else {
|
} else {
|
||||||
|
@ -76,9 +76,7 @@ public class BasicConnectionPool implements ConnectionPool {
|
||||||
}
|
}
|
||||||
|
|
||||||
public void shutdown() throws SQLException {
|
public void shutdown() throws SQLException {
|
||||||
for (Connection c : usedConnections) {
|
usedConnections.forEach(this::releaseConnection);
|
||||||
this.releaseConnection(c);
|
|
||||||
}
|
|
||||||
for (Connection c : connectionPool) {
|
for (Connection c : connectionPool) {
|
||||||
c.close();
|
c.close();
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue