OPENJPA-2134. Do not close Connections during prepareForPooling if ConnectionRetainMode is set to "always".

git-svn-id: https://svn.apache.org/repos/asf/openjpa/trunk@1291900 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Kevin W. Sutter 2012-02-21 16:31:22 +00:00
parent cecd73b6ee
commit c55f8469f1

View File

@ -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();
}
}
}