openjpa-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From kwsut...@apache.org
Subject svn commit: r1291900 - /openjpa/trunk/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/EntityManagerImpl.java
Date Tue, 21 Feb 2012 16:31:23 GMT
Author: kwsutter
Date: Tue Feb 21 16:31:22 2012
New Revision: 1291900

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

Modified:
    openjpa/trunk/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/EntityManagerImpl.java

Modified: openjpa/trunk/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/EntityManagerImpl.java
URL: http://svn.apache.org/viewvc/openjpa/trunk/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/EntityManagerImpl.java?rev=1291900&r1=1291899&r2=1291900&view=diff
==============================================================================
--- openjpa/trunk/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/EntityManagerImpl.java
(original)
+++ openjpa/trunk/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/EntityManagerImpl.java
Tue Feb 21 16:31:22 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