Skip to content

Commit 2f096b2

Browse files
author
chengyitian
committed
AJ-751: add pool status check when getConnection();
1 parent a563203 commit 2f096b2

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

src/com/xxdb/SimpleDBConnectionPool.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,9 @@ public void run() {
102102
* Get an Idle Connection from the Connection Pool.
103103
*/
104104
public DBConnection getConnection() {
105+
if (isClosed())
106+
throw new RuntimeException("The connection pool has been closed.");
107+
105108
for (PoolEntry poolEntry : poolEntries) {
106109
if (poolEntry.inUse.compareAndSet(false, true)) {
107110
return poolEntry;

0 commit comments

Comments
 (0)