Permalink
Browse files

restore default autocommit/readonly/catalog when the connection is ch…

…ecked in again.
  • Loading branch information...
1 parent f514c1f commit fb41f07ebe84bac9a7e1ffbe49e6c76845cf0656 @wwadge committed May 31, 2011
Showing with 15 additions and 0 deletions.
  1. +15 −0 bonecp/src/main/java/com/jolbox/bonecp/BoneCP.java
@@ -659,6 +659,21 @@ protected void putConnectionBackInPartition(ConnectionHandle connectionHandle) t
connectionHandle.getInternalConnection().rollback();
connectionHandle.getInternalConnection().setAutoCommit(true);
}
+
+ // restore sanity
+ if (this.defaultAutoCommit != null){
+ connectionHandle.setAutoCommit(this.defaultAutoCommit);
+ }
+ if (this.defaultReadOnly != null){
+ connectionHandle.setReadOnly(this.defaultReadOnly);
+ }
+ if (this.defaultCatalog != null){
+ connectionHandle.setCatalog(this.defaultCatalog);
+ }
+ if (this.defaultTransactionIsolationValue != -1){
+ connectionHandle.setTransactionIsolation(this.defaultTransactionIsolationValue);
+ }
+
if (this.cachedPoolStrategy && connectionHandle.inUseInThreadLocalContext.get()){
// this might fail if we have a thread that takes up more than one thread

0 comments on commit fb41f07

Please sign in to comment.