User: osh
Date: 00/10/07 22:30:18
Modified: src/main/org/jboss/ejb/plugins
EntitySynchronizationInterceptor.java
TxInterceptorBMT.java TxInterceptorCMT.java
Log:
Catch IllegalStateException from setRollbackOnly() to avoid race with tx timeout.
Revision Changes Path
1.20 +3 -1
jboss/src/main/org/jboss/ejb/plugins/EntitySynchronizationInterceptor.java
Index: EntitySynchronizationInterceptor.java
===================================================================
RCS file:
/products/cvs/ejboss/jboss/src/main/org/jboss/ejb/plugins/EntitySynchronizationInterceptor.java,v
retrieving revision 1.19
retrieving revision 1.20
diff -u -r1.19 -r1.20
--- EntitySynchronizationInterceptor.java 2000/09/30 00:59:40 1.19
+++ EntitySynchronizationInterceptor.java 2000/10/08 05:30:17 1.20
@@ -48,7 +48,7 @@
* @see <related>
* @author Rickard �berg ([EMAIL PROTECTED])
* @author <a href="mailto:[EMAIL PROTECTED]">Marc Fleury</a>
-* @version $Revision: 1.19 $
+* @version $Revision: 1.20 $
*/
public class EntitySynchronizationInterceptor
extends AbstractInterceptor
@@ -332,6 +332,8 @@
try {
tx.setRollbackOnly();
} catch (SystemException ex) {
+ // DEBUG ex.printStackTrace();
+ } catch (IllegalStateException ex) {
// DEBUG ex.printStackTrace();
}
}
1.7 +37 -13 jboss/src/main/org/jboss/ejb/plugins/TxInterceptorBMT.java
Index: TxInterceptorBMT.java
===================================================================
RCS file:
/products/cvs/ejboss/jboss/src/main/org/jboss/ejb/plugins/TxInterceptorBMT.java,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -r1.6 -r1.7
--- TxInterceptorBMT.java 2000/09/30 00:59:41 1.6
+++ TxInterceptorBMT.java 2000/10/08 05:30:17 1.7
@@ -49,7 +49,7 @@
* @see <related>
* @author <a href="mailto:[EMAIL PROTECTED]">Marc Fleury</a>
* @author <a href="mailto:[EMAIL PROTECTED]">Sebastien Alborini</a>
-* @version $Revision: 1.6 $
+* @version $Revision: 1.7 $
*/
public class TxInterceptorBMT
extends AbstractInterceptor
@@ -136,22 +136,34 @@
} catch (RuntimeException e)
{
// EJB 2.0 17.3, table 16
- if (mi.getEnterpriseContext().getTransaction() != null)
-
mi.getEnterpriseContext().getTransaction().setRollbackOnly();
+ if (mi.getEnterpriseContext().getTransaction() !=
null) {
+ try {
+
mi.getEnterpriseContext().getTransaction().setRollbackOnly();
+ } catch (IllegalStateException ex) {
+ }
+ }
throw new ServerException("Transaction rolled back",
e);
} catch (RemoteException e)
{
// EJB 2.0 17.3, table 16
- if (mi.getEnterpriseContext().getTransaction() != null)
-
mi.getEnterpriseContext().getTransaction().setRollbackOnly();
+ if (mi.getEnterpriseContext().getTransaction() !=
null) {
+ try {
+
mi.getEnterpriseContext().getTransaction().setRollbackOnly();
+ } catch (IllegalStateException ex) {
+ }
+ }
throw new ServerException("Transaction rolled back",
e);
} catch (Error e)
{
// EJB 2.0 17.3, table 16
- if (mi.getEnterpriseContext().getTransaction() != null)
-
mi.getEnterpriseContext().getTransaction().setRollbackOnly();
+ if (mi.getEnterpriseContext().getTransaction() !=
null) {
+ try {
+
mi.getEnterpriseContext().getTransaction().setRollbackOnly();
+ } catch (IllegalStateException ex) {
+ }
+ }
throw new ServerException("Transaction rolled
back:"+e.getMessage());
} finally {
@@ -229,22 +241,34 @@
} catch (RuntimeException e)
{
// EJB 2.0 17.3, table 16
- if (mi.getEnterpriseContext().getTransaction() != null)
-
mi.getEnterpriseContext().getTransaction().setRollbackOnly();
+ if (mi.getEnterpriseContext().getTransaction() != null) {
+ try {
+
mi.getEnterpriseContext().getTransaction().setRollbackOnly();
+ } catch (IllegalStateException ex) {
+ }
+ }
throw new ServerException("Transaction rolled back", e);
} catch (RemoteException e)
{
// EJB 2.0 17.3, table 16
- if (mi.getEnterpriseContext().getTransaction() != null)
-
mi.getEnterpriseContext().getTransaction().setRollbackOnly();
+ if (mi.getEnterpriseContext().getTransaction() != null) {
+ try {
+
mi.getEnterpriseContext().getTransaction().setRollbackOnly();
+ } catch (IllegalStateException ex) {
+ }
+ }
throw new ServerException("Transaction rolled back", e);
} catch (Error e)
{
// EJB 2.0 17.3, table 16
- if (mi.getEnterpriseContext().getTransaction() != null)
-
mi.getEnterpriseContext().getTransaction().setRollbackOnly();
+ if (mi.getEnterpriseContext().getTransaction() != null) {
+ try {
+
mi.getEnterpriseContext().getTransaction().setRollbackOnly();
+ } catch (IllegalStateException ex) {
+ }
+ }
throw new ServerException("Transaction rolled
back:"+e.getMessage());
} finally {
1.6 +13 -4 jboss/src/main/org/jboss/ejb/plugins/TxInterceptorCMT.java
Index: TxInterceptorCMT.java
===================================================================
RCS file:
/products/cvs/ejboss/jboss/src/main/org/jboss/ejb/plugins/TxInterceptorCMT.java,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- TxInterceptorCMT.java 2000/09/30 00:59:41 1.5
+++ TxInterceptorCMT.java 2000/10/08 05:30:17 1.6
@@ -40,7 +40,7 @@
* @author Rickard �berg ([EMAIL PROTECTED])
* @author <a href="mailto:[EMAIL PROTECTED]">Marc Fleury</a>
* @author <a href="mailto:[EMAIL PROTECTED]">Sebastien Alborini</a>
-* @version $Revision: 1.5 $
+* @version $Revision: 1.6 $
*/
public class TxInterceptorCMT
extends AbstractInterceptor
@@ -139,7 +139,10 @@
// EJB 2.0 17.3, table 15
if (mi.getTransaction() != null)
{
- mi.getTransaction().setRollbackOnly();
+ try {
+ mi.getTransaction().setRollbackOnly();
+ } catch (IllegalStateException ex) {
+ }
RemoteException tre = new
TransactionRolledbackException(e.getMessage());
tre.detail = e;
throw tre;
@@ -153,7 +156,10 @@
// EJB 2.0 17.3, table 15
if (mi.getTransaction() != null)
{
- mi.getTransaction().setRollbackOnly();
+ try {
+ mi.getTransaction().setRollbackOnly();
+ } catch (IllegalStateException ex) {
+ }
RemoteException tre = new
TransactionRolledbackException(e.getMessage());
tre.detail = e;
throw tre;
@@ -167,7 +173,10 @@
// EJB 2.0 17.3, table 15
if (mi.getTransaction() != null)
{
- mi.getTransaction().setRollbackOnly();
+ try {
+ mi.getTransaction().setRollbackOnly();
+ } catch (IllegalStateException ex) {
+ }
RemoteException tre = new
TransactionRolledbackException(e.getMessage());
tre.detail = e;
throw tre;