Skip to content

Commit d672910

Browse files
authored
Merge pull request #113 from FOCONIS/lock-pstatementcache
Pstatementcache must be locked in closeConnectionFully
2 parents 7627589 + 6218aef commit d672910

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

ebean-datasource/src/main/java/io/ebean/datasource/pool/PooledConnection.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -250,6 +250,7 @@ void closeConnectionFully(boolean logErrors) {
250250
Log.error("Error checking if connection [" + name + "] is closed", ex);
251251
}
252252
}
253+
lock.lock();
253254
try {
254255
for (ExtendedPreparedStatement ps : pstmtCache.values()) {
255256
ps.closeDestroy();
@@ -258,6 +259,8 @@ void closeConnectionFully(boolean logErrors) {
258259
if (logErrors) {
259260
Log.warn("Error when closing connection Statements", ex);
260261
}
262+
} finally {
263+
lock.unlock();
261264
}
262265
try {
263266
// DB2 (and some other DBMS) may have uncommitted changes and do not allow close

0 commit comments

Comments
 (0)