[jboss-cvs] JBossAS SVN: r60477 - trunk/server/src/main/org/jboss/ejb.
jboss-cvs-commits at lists.jboss.org
jboss-cvs-commits at lists.jboss.org
Sat Feb 10 15:53:38 EST 2007
Author: alex.loubyansky at jboss.com
Date: 2007-02-10 15:53:38 -0500 (Sat, 10 Feb 2007)
New Revision: 60477
Modified:
trunk/server/src/main/org/jboss/ejb/StatelessSessionEnterpriseContext.java
Log:
JBAS-4086
Modified: trunk/server/src/main/org/jboss/ejb/StatelessSessionEnterpriseContext.java
===================================================================
--- trunk/server/src/main/org/jboss/ejb/StatelessSessionEnterpriseContext.java 2007-02-10 19:47:15 UTC (rev 60476)
+++ trunk/server/src/main/org/jboss/ejb/StatelessSessionEnterpriseContext.java 2007-02-10 20:53:38 UTC (rev 60477)
@@ -23,6 +23,11 @@
import javax.ejb.*;
import javax.transaction.UserTransaction;
+import javax.transaction.NotSupportedException;
+import javax.transaction.SystemException;
+import javax.transaction.RollbackException;
+import javax.transaction.HeuristicMixedException;
+import javax.transaction.HeuristicRollbackException;
import javax.xml.rpc.handler.MessageContext;
import java.io.Serializable;
import java.lang.reflect.InvocationTargetException;
@@ -248,9 +253,58 @@
{
AllowedOperationsAssociation.assertAllowedIn("getUserTransaction",
IN_EJB_CREATE | IN_EJB_REMOVE | IN_BUSINESS_METHOD | IN_EJB_TIMEOUT | IN_SERVICE_ENDPOINT_METHOD);
- return super.getUserTransaction();
+ final UserTransaction ut = super.getUserTransaction();
+ return new UserTransaction()
+ {
+ public void begin() throws NotSupportedException, SystemException
+ {
+ checkUserTransactionMethods();
+ ut.begin();
+ }
+
+ public void commit() throws RollbackException,
+ HeuristicMixedException,
+ HeuristicRollbackException,
+ SecurityException,
+ IllegalStateException,
+ SystemException
+ {
+ checkUserTransactionMethods();
+ ut.commit();
+ }
+
+ public void rollback() throws IllegalStateException, SecurityException, SystemException
+ {
+ checkUserTransactionMethods();
+ ut.rollback();
+ }
+
+ public void setRollbackOnly() throws IllegalStateException, SystemException
+ {
+ checkUserTransactionMethods();
+ ut.setRollbackOnly();
+ }
+
+ public int getStatus() throws SystemException
+ {
+ checkUserTransactionMethods();
+ return ut.getStatus();
+ }
+
+ public void setTransactionTimeout(int seconds) throws SystemException
+ {
+ checkUserTransactionMethods();
+ ut.setTransactionTimeout(seconds);
+ }
+ };
}
+ private void checkUserTransactionMethods()
+ {
+ AllowedOperationsAssociation.assertAllowedIn("UserTransaction methods",
+ IN_BUSINESS_METHOD | IN_EJB_TIMEOUT | IN_SERVICE_ENDPOINT_METHOD);
+ }
+
public MessageContext getMessageContext() throws IllegalStateException
{
AllowedOperationsAssociation.assertAllowedIn("getMessageContext",
More information about the jboss-cvs-commits
mailing list