[seam-commits] Seam SVN: r11990 - branches/community/Seam_2_2/src/main/org/jboss/seam/persistence.
seam-commits at lists.jboss.org
seam-commits at lists.jboss.org
Mon Jan 25 18:55:21 EST 2010
Author: manaRH
Date: 2010-01-25 18:55:21 -0500 (Mon, 25 Jan 2010)
New Revision: 11990
Modified:
branches/community/Seam_2_2/src/main/org/jboss/seam/persistence/ManagedPersistenceContext.java
Log:
JBSEAM-3778
Modified: branches/community/Seam_2_2/src/main/org/jboss/seam/persistence/ManagedPersistenceContext.java
===================================================================
--- branches/community/Seam_2_2/src/main/org/jboss/seam/persistence/ManagedPersistenceContext.java 2010-01-25 16:31:18 UTC (rev 11989)
+++ branches/community/Seam_2_2/src/main/org/jboss/seam/persistence/ManagedPersistenceContext.java 2010-01-25 23:55:21 UTC (rev 11990)
@@ -22,6 +22,7 @@
import org.jboss.seam.annotations.Scope;
import org.jboss.seam.annotations.Unwrap;
import org.jboss.seam.annotations.intercept.BypassInterceptors;
+import org.jboss.seam.contexts.Contexts;
import org.jboss.seam.contexts.Lifecycle;
import org.jboss.seam.core.Mutable;
import org.jboss.seam.core.Expressions.ValueExpression;
@@ -199,32 +200,36 @@
private void close()
{
- boolean transactionActive = false;
-
- try
+ if (Contexts.isEventContextActive())
{
- UserTransaction tx = Transaction.instance();
- try
+
+ boolean transactionActive = false;
+
+ try
{
- transactionActive = tx.isActive();
+ UserTransaction tx = Transaction.instance();
+ try
+ {
+ transactionActive = tx.isActive();
+ }
+ catch (SystemException se)
+ {
+ log.debug("could not get transaction status while destroying persistence context");
+ }
}
- catch (SystemException se)
+ catch (Exception e)
{
- log.debug("could not get transaction status while destroying persistence context");
+ // WebSphere throws a javax.naming.ConfigurationException when Transaction.instance() is called during HTTP Session expiration
+ // and there is no JNDI lookup possible. See details there: JBSEAM-4332
+ log.warn("could not get transaction while destroying persistence context. (called during session expiration ?)");
}
+
+ if ( transactionActive )
+ {
+ throw new IllegalStateException("attempting to destroy the persistence context while an active transaction exists (try installing <transaction:ejb-transaction/>)");
+ }
}
- catch (Exception e)
- {
- // WebSphere throws a javax.naming.ConfigurationException when Transaction.instance() is called during HTTP Session expiration
- // and there is no JNDI lookup possible. See details there: JBSEAM-4332
- log.warn("could not get transaction while destroying persistence context. (called during session expiration ?)");
- }
- if ( transactionActive )
- {
- throw new IllegalStateException("attempting to destroy the persistence context while an active transaction exists (try installing <transaction:ejb-transaction/>)");
- }
-
if ( log.isDebugEnabled() )
{
log.debug("destroying seam managed persistence context for persistence unit: " + persistenceUnitJndiName);
More information about the seam-commits
mailing list