openjpa-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From kwsut...@apache.org
Subject svn commit: r1291917 - /openjpa/branches/2.2.x/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/EntityManagerImpl.java
Date Tue, 21 Feb 2012 17:04:27 GMT
Author: kwsutter
Date: Tue Feb 21 17:04:27 2012
New Revision: 1291917

URL: http://svn.apache.org/viewvc?rev=1291917&view=rev
Log:
OPENJPA-2134.  Do not close Connections during prepareForPooling if ConnectionRetainMode is
set to "always".

Modified:
    openjpa/branches/2.2.x/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/EntityManagerImpl.java

Modified: openjpa/branches/2.2.x/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/EntityManagerImpl.java
URL: http://svn.apache.org/viewvc/openjpa/branches/2.2.x/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/EntityManagerImpl.java?rev=1291917&r1=1291916&r2=1291917&view=diff
==============================================================================
--- openjpa/branches/2.2.x/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/EntityManagerImpl.java
(original)
+++ openjpa/branches/2.2.x/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/EntityManagerImpl.java
Tue Feb 21 17:04:27 2012
@@ -1156,11 +1156,14 @@ public class EntityManagerImpl
     public void prepareForPooling() {
         assertNotCloseInvoked();
         clear();
-        _broker.lock();  // since this direct close path is not protected...
-        try {
-            _broker.getStoreManager().close();
-        } finally {
-            _broker.unlock();
+        // Do not close connection if ConnectionRetainMode is set to Always...
+        if (getConnectionRetainMode() != ConnectionRetainMode.ALWAYS) {
+            _broker.lock();  // since this direct close path is not protected...
+            try {
+                _broker.getStoreManager().close();
+            } finally {
+                _broker.unlock();
+            }
         }
     }
     



Mime
View raw message