Author: swd847
Date: 2010-08-31 23:08:01 -0400 (Tue, 31 Aug 2010)
New Revision: 13684
Modified:
modules/persistence/trunk/impl/src/main/java/org/jboss/seam/persistence/ManagedPersistenceContextProxyHandler.java
Log:
minor
Modified:
modules/persistence/trunk/impl/src/main/java/org/jboss/seam/persistence/ManagedPersistenceContextProxyHandler.java
===================================================================
---
modules/persistence/trunk/impl/src/main/java/org/jboss/seam/persistence/ManagedPersistenceContextProxyHandler.java 2010-09-01
02:55:52 UTC (rev 13683)
+++
modules/persistence/trunk/impl/src/main/java/org/jboss/seam/persistence/ManagedPersistenceContextProxyHandler.java 2010-09-01
03:08:01 UTC (rev 13684)
@@ -69,7 +69,7 @@
private boolean persistenceContextsTouched = false;
- private boolean closed = false;
+ private boolean closeOnTransactionCommit = false;
static final Logger log =
LoggerFactory.getLogger(ManagedPersistenceContextProxyHandler.class);
@@ -136,25 +136,19 @@
}
}
- private void setClosed()
+ private void setClosed()throws SystemException
{
SeamTransaction transaction = userTransactionInstance.get();
- try
+ if (transaction.isActive())
{
- if(transaction.isActive())
+ closeOnTransactionCommit = true;
+ }
+ else
+ {
+ if (delegate.isOpen())
{
- closed = true;
+ delegate.close();
}
- else
- {
- if(delegate.isOpen())
- {
- delegate.close();
- }
- }
- } catch (SystemException e)
- {
- throw new RuntimeException(e);
}
}
@@ -184,7 +178,7 @@
public void afterCompletion(int status)
{
synchronizationRegistered = false;
- if(closed)
+ if(closeOnTransactionCommit && delegate.isOpen())
{
delegate.close();
}
Show replies by date