Skip to content

Commit 54958c4

Browse files
author
lucaijun
committed
AJ-542: add simple connection pool with connection count
1 parent 7003e49 commit 54958c4

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

src/com/xxdb/SimpleDBConnectionPool.java

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -57,14 +57,18 @@ else if (Objects.nonNull(connectionPool)) {
5757
}
5858
}
5959

60-
public int getActiveConnections() {
60+
public int getActiveConnectionsCount() {
6161
return connectionPool.getCount(false);
6262
}
6363

64-
public int getIdleConnections() {
64+
public int getIdleConnectionsCount() {
6565
return connectionPool.getCount(true);
6666
}
6767

68+
public int getTotalConnectionsCount() {
69+
return connectionPool.getTotalCount();
70+
}
71+
6872
public void close() {
6973
if (Objects.nonNull(connectionPool))
7074
connectionPool.close();
@@ -119,6 +123,10 @@ int getCount(boolean isIdle) {
119123
return count;
120124
}
121125

126+
int getTotalCount() {
127+
return poolEntries.size();
128+
}
129+
122130
void close() {
123131
if (!this.isShutdown.getAndSet(true)) {
124132
log.info("Closing the connection pool......");

0 commit comments

Comments
 (0)