geronimo-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From djen...@apache.org
Subject svn commit: rev 54805 - in geronimo/trunk/modules: jetty/src/java/org/apache/geronimo/jetty jetty/src/java/org/apache/geronimo/jetty/deployment jetty/src/test/org/apache/geronimo/jetty transaction/src/java/org/apache/geronimo/transaction transaction/src/java/org/apache/geronimo/transaction/manager
Date Thu, 14 Oct 2004 21:51:14 GMT
Author: djencks
Date: Thu Oct 14 14:51:13 2004
New Revision: 54805

Added:
   geronimo/trunk/modules/transaction/src/java/org/apache/geronimo/transaction/OnlineUserTransaction.java
Modified:
   geronimo/trunk/modules/jetty/src/java/org/apache/geronimo/jetty/JettyWebAppContext.java
   geronimo/trunk/modules/jetty/src/java/org/apache/geronimo/jetty/JettyWebAppJACCContext.java
   geronimo/trunk/modules/jetty/src/java/org/apache/geronimo/jetty/deployment/JettyModuleBuilder.java
   geronimo/trunk/modules/jetty/src/test/org/apache/geronimo/jetty/ApplicationTest.java
   geronimo/trunk/modules/jetty/src/test/org/apache/geronimo/jetty/SecurityTest.java
   geronimo/trunk/modules/transaction/src/java/org/apache/geronimo/transaction/TransactionManagerProxy.java
   geronimo/trunk/modules/transaction/src/java/org/apache/geronimo/transaction/UserTransactionImpl.java
   geronimo/trunk/modules/transaction/src/java/org/apache/geronimo/transaction/manager/Recovery.java
   geronimo/trunk/modules/transaction/src/java/org/apache/geronimo/transaction/manager/ResourceManager.java
Log:
Separate non-thread-local UserTransaction for use by web apps.  Further fix web app tx handling

Modified: geronimo/trunk/modules/jetty/src/java/org/apache/geronimo/jetty/JettyWebAppContext.java
==============================================================================
--- geronimo/trunk/modules/jetty/src/java/org/apache/geronimo/jetty/JettyWebAppContext.java
(original)
+++ geronimo/trunk/modules/jetty/src/java/org/apache/geronimo/jetty/JettyWebAppContext.java
Thu Oct 14 14:51:13 2004
@@ -23,6 +23,10 @@
 import java.net.URL;
 import java.util.Set;
 import javax.resource.ResourceException;
+import javax.transaction.HeuristicMixedException;
+import javax.transaction.HeuristicRollbackException;
+import javax.transaction.RollbackException;
+import javax.transaction.SystemException;
 
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
@@ -34,8 +38,9 @@
 import org.apache.geronimo.naming.java.RootContext;
 import org.apache.geronimo.transaction.DefaultInstanceContext;
 import org.apache.geronimo.transaction.InstanceContext;
+import org.apache.geronimo.transaction.OnlineUserTransaction;
 import org.apache.geronimo.transaction.TrackedConnectionAssociator;
-import org.apache.geronimo.transaction.UserTransactionImpl;
+import org.apache.geronimo.transaction.context.InheritableTransactionContext;
 import org.apache.geronimo.transaction.context.TransactionContext;
 import org.apache.geronimo.transaction.context.TransactionContextManager;
 import org.mortbay.http.HttpException;
@@ -52,7 +57,7 @@
     private static Log log = LogFactory.getLog(JettyWebAppContext.class);
 
     private final ReadOnlyContext componentContext;
-    private final UserTransactionImpl userTransaction;
+    private final OnlineUserTransaction userTransaction;
     private final ClassLoader classLoader;
     private final Set unshareableResources;
     private final Set applicationManagedSecurityResources;
@@ -78,17 +83,17 @@
     }
 
     public JettyWebAppContext(URI uri,
-            ReadOnlyContext componentContext,
-            UserTransactionImpl userTransaction,
-            ClassLoader classLoader,
-            URI[] webClassPath,
-            boolean contextPriorityClassLoader,
-            URL configurationBaseUrl,
-            Set unshareableResources,
-            Set applicationManagedSecurityResources,
-            TransactionContextManager transactionContextManager,
-            TrackedConnectionAssociator trackedConnectionAssociator,
-            JettyContainer jettyContainer) throws MalformedURLException {
+                              ReadOnlyContext componentContext,
+                              OnlineUserTransaction userTransaction,
+                              ClassLoader classLoader,
+                              URI[] webClassPath,
+                              boolean contextPriorityClassLoader,
+                              URL configurationBaseUrl,
+                              Set unshareableResources,
+                              Set applicationManagedSecurityResources,
+                              TransactionContextManager transactionContextManager,
+                              TrackedConnectionAssociator trackedConnectionAssociator,
+                              JettyContainer jettyContainer) throws MalformedURLException
{
 
         assert uri != null;
         assert componentContext != null;
@@ -124,10 +129,11 @@
         setClassLoader(this.classLoader);
     }
 
+    //TODO tx logic may not be complete.  exceptions are certainly wrong!
     public void handle(String pathInContext,
-            String pathParams,
-            HttpRequest httpRequest,
-            HttpResponse httpResponse)
+                       String pathParams,
+                       HttpRequest httpRequest,
+                       HttpResponse httpResponse)
             throws HttpException, IOException {
 
         // save previous state
@@ -139,14 +145,11 @@
             // set up java:comp JNDI Context
             RootContext.setComponentContext(componentContext);
 
-            // Turn on the UserTransaction
-            userTransaction.setOnline(true);
 
-            TransactionContext transactionContext = transactionContextManager.getContext();
-            if (transactionContext == null) {
-                transactionContext = transactionContextManager.newUnspecifiedTransactionContext();
-            } else {
-                transactionContext = null;
+            TransactionContext oldTransactionContext = transactionContextManager.getContext();
+            TransactionContext newTransactionContext = null;
+            if (oldTransactionContext == null || !(oldTransactionContext instanceof InheritableTransactionContext))
{
+                newTransactionContext = transactionContextManager.newUnspecifiedTransactionContext();
             }
 
             try {
@@ -158,14 +161,34 @@
 
                 super.handle(pathInContext, pathParams, httpRequest, httpResponse);
             } finally {
-                if (transactionContext != null) {
-                    transactionContextManager.setContext(null);
-                    try {
-                        transactionContext.commit();
-                    } catch (Exception e) {
-                        //TODO this is undoubtedly the wrong error code!
-                        throw (HttpException) new HttpException(500, "Problem committing
unspecified transaction context").initCause(e);
+                try {
+                    if (newTransactionContext != null) {
+                        if (newTransactionContext != transactionContextManager.getContext())
{
+                            transactionContextManager.getContext().rollback();
+                            newTransactionContext.rollback();
+                            throw new HttpException(500, "WRONG EXCEPTION! returned from
servlet call with wrong tx context");
+                        }
+                        newTransactionContext.commit();
+
+                    } else {
+                        if (oldTransactionContext != transactionContextManager.getContext())
{
+                            if (transactionContextManager.getContext() != null) {
+                                transactionContextManager.getContext().rollback();
+                            }
+                            throw new HttpException(500, "WRONG EXCEPTION! returned from
servlet call with wrong tx context");
+                        }
                     }
+                } catch (SystemException e) {
+                    throw (HttpException) new HttpException(500, "WRONG EXCEPTION!").initCause(e);
+                } catch (HeuristicMixedException e) {
+                    throw (HttpException) new HttpException(500, "WRONG EXCEPTION!").initCause(e);
+                } catch (HeuristicRollbackException e) {
+                    throw (HttpException) new HttpException(500, "WRONG EXCEPTION!").initCause(e);
+                } catch (RollbackException e) {
+                    throw (HttpException) new HttpException(500, "WRONG EXCEPTION!").initCause(e);
+                } finally {
+                    //this is redundant when we enter with an inheritable context and nothing
goes wrong.
+                    transactionContextManager.setContext(oldTransactionContext);
                 }
             }
         } finally {
@@ -174,10 +197,8 @@
             } catch (ResourceException e) {
                 throw new RuntimeException(e);
             } finally {
-                userTransaction.setOnline(false);
                 RootContext.setComponentContext(oldComponentContext);
             }
-            //TODO should we reset the transactioncontext to null if we set it?
         }
     }
 
@@ -194,6 +215,7 @@
         setWAR(webAppRoot.toString());
 
         userTransaction.setUp(transactionContextManager, trackedConnectionAssociator);
+
         jettyContainer.addContext(this);
 
         ClassLoader oldCL = Thread.currentThread().getContextClassLoader();
@@ -203,9 +225,7 @@
             InstanceContext oldInstanceContext = null;
             try {
                 RootContext.setComponentContext(componentContext);
-                // Turn on the UserTransaction
-                userTransaction.setOnline(true);
-
+//TODO FIXME!!!
                 TransactionContext transactionContext = transactionContextManager.getContext();
                 if (transactionContext == null) {
                     transactionContext = transactionContextManager.newUnspecifiedTransactionContext();
@@ -239,7 +259,6 @@
                 } catch (ResourceException e) {
                     throw new RuntimeException(e);
                 } finally {
-                    userTransaction.setOnline(false);
                     RootContext.setComponentContext(oldComponentContext);
                 }
                 //TODO should we reset the transactioncontext to null if we set it?
@@ -265,8 +284,6 @@
             InstanceContext oldInstanceContext = null;
             try {
                 RootContext.setComponentContext(componentContext);
-                // Turn on the UserTransaction
-                userTransaction.setOnline(true);
 
                 TransactionContext transactionContext = transactionContextManager.getContext();
                 if (transactionContext == null) {
@@ -307,15 +324,11 @@
                 } catch (ResourceException e) {
                     throw new RuntimeException(e);
                 } finally {
-                    userTransaction.setOnline(false);
                     RootContext.setComponentContext(oldComponentContext);
                 }
                 //TODO should we reset the transactioncontext to null if we set it?
             }
             jettyContainer.removeContext(this);
-            if (userTransaction != null) {
-                userTransaction.setOnline(false);
-            }
         } finally {
             Thread.currentThread().setContextClassLoader(oldCL);
         }
@@ -340,7 +353,7 @@
 
         infoFactory.addAttribute("uri", URI.class, true);
         infoFactory.addAttribute("componentContext", ReadOnlyContext.class, true);
-        infoFactory.addAttribute("userTransaction", UserTransactionImpl.class, true);
+        infoFactory.addAttribute("userTransaction", OnlineUserTransaction.class, true);
         infoFactory.addAttribute("classLoader", ClassLoader.class, false);
         infoFactory.addAttribute("webClassPath", URI[].class, true);
         infoFactory.addAttribute("contextPriorityClassLoader", boolean.class, true);

Modified: geronimo/trunk/modules/jetty/src/java/org/apache/geronimo/jetty/JettyWebAppJACCContext.java
==============================================================================
--- geronimo/trunk/modules/jetty/src/java/org/apache/geronimo/jetty/JettyWebAppJACCContext.java
(original)
+++ geronimo/trunk/modules/jetty/src/java/org/apache/geronimo/jetty/JettyWebAppJACCContext.java
Thu Oct 14 14:51:13 2004
@@ -54,6 +54,7 @@
 import org.apache.geronimo.security.util.ConfigurationUtil;
 import org.apache.geronimo.transaction.TrackedConnectionAssociator;
 import org.apache.geronimo.transaction.UserTransactionImpl;
+import org.apache.geronimo.transaction.OnlineUserTransaction;
 import org.apache.geronimo.transaction.context.TransactionContextManager;
 import org.mortbay.http.Authenticator;
 import org.mortbay.http.HttpException;
@@ -98,7 +99,7 @@
     public JettyWebAppJACCContext(
             URI uri,
             ReadOnlyContext componentContext,
-            UserTransactionImpl userTransaction,
+            OnlineUserTransaction userTransaction,
             ClassLoader classLoader,
             URI[] webClassPath,
             boolean contextPriorityClassLoader,

Modified: geronimo/trunk/modules/jetty/src/java/org/apache/geronimo/jetty/deployment/JettyModuleBuilder.java
==============================================================================
--- geronimo/trunk/modules/jetty/src/java/org/apache/geronimo/jetty/deployment/JettyModuleBuilder.java
(original)
+++ geronimo/trunk/modules/jetty/src/java/org/apache/geronimo/jetty/deployment/JettyModuleBuilder.java
Thu Oct 14 14:51:13 2004
@@ -61,7 +61,7 @@
 import org.apache.geronimo.security.deploy.Realm;
 import org.apache.geronimo.security.deploy.Role;
 import org.apache.geronimo.security.deploy.Security;
-import org.apache.geronimo.transaction.UserTransactionImpl;
+import org.apache.geronimo.transaction.OnlineUserTransaction;
 import org.apache.geronimo.xbeans.geronimo.jetty.JettyDefaultPrincipalType;
 import org.apache.geronimo.xbeans.geronimo.jetty.JettyDependencyType;
 import org.apache.geronimo.xbeans.geronimo.jetty.JettyGbeanType;
@@ -303,7 +303,7 @@
             throw new DeploymentException("Unable to construct ObjectName", e);
         }
 
-        UserTransaction userTransaction = new UserTransactionImpl();
+        UserTransaction userTransaction = new OnlineUserTransaction();
         ReadOnlyContext compContext = buildComponentContext(earContext, webModule, webApp,
jettyWebApp, userTransaction, webClassLoader);
 
         Security security = buildSecurityConfig(jettyWebApp);

Modified: geronimo/trunk/modules/jetty/src/test/org/apache/geronimo/jetty/ApplicationTest.java
==============================================================================
--- geronimo/trunk/modules/jetty/src/test/org/apache/geronimo/jetty/ApplicationTest.java	(original)
+++ geronimo/trunk/modules/jetty/src/test/org/apache/geronimo/jetty/ApplicationTest.java	Thu
Oct 14 14:51:13 2004
@@ -34,7 +34,7 @@
 import org.apache.geronimo.jetty.connector.HTTPConnector;
 import org.apache.geronimo.kernel.Kernel;
 import org.apache.geronimo.transaction.GeronimoTransactionManager;
-import org.apache.geronimo.transaction.UserTransactionImpl;
+import org.apache.geronimo.transaction.OnlineUserTransaction;
 import org.apache.geronimo.transaction.context.TransactionContextManager;
 
 /**
@@ -63,7 +63,7 @@
         GBeanMBean app = new GBeanMBean(JettyWebAppContext.GBEAN_INFO);
         app.setAttribute("uri", URI.create("war1/"));
         app.setAttribute("componentContext", null);
-        UserTransactionImpl userTransaction = new UserTransactionImpl();
+        OnlineUserTransaction userTransaction = new OnlineUserTransaction();
         app.setAttribute("userTransaction", userTransaction);
         app.setAttribute("webClassPath", new URI[0]);
         app.setAttribute("contextPriorityClassLoader", Boolean.FALSE);

Modified: geronimo/trunk/modules/jetty/src/test/org/apache/geronimo/jetty/SecurityTest.java
==============================================================================
--- geronimo/trunk/modules/jetty/src/test/org/apache/geronimo/jetty/SecurityTest.java	(original)
+++ geronimo/trunk/modules/jetty/src/test/org/apache/geronimo/jetty/SecurityTest.java	Thu
Oct 14 14:51:13 2004
@@ -41,7 +41,7 @@
 import org.apache.geronimo.security.deploy.Security;
 import org.apache.geronimo.system.serverinfo.ServerInfo;
 import org.apache.geronimo.transaction.GeronimoTransactionManager;
-import org.apache.geronimo.transaction.UserTransactionImpl;
+import org.apache.geronimo.transaction.OnlineUserTransaction;
 import org.apache.geronimo.transaction.context.TransactionContextManager;
 
 
@@ -107,7 +107,7 @@
 
         app.setAttribute("uri", URI.create("war3/"));
         app.setAttribute("componentContext", null);
-        UserTransactionImpl userTransaction = new UserTransactionImpl();
+        OnlineUserTransaction userTransaction = new OnlineUserTransaction();
         app.setAttribute("userTransaction", userTransaction);
         app.setAttribute("webClassPath", new URI[0]);
         app.setAttribute("contextPriorityClassLoader", Boolean.FALSE);

Added: geronimo/trunk/modules/transaction/src/java/org/apache/geronimo/transaction/OnlineUserTransaction.java
==============================================================================
--- (empty file)
+++ geronimo/trunk/modules/transaction/src/java/org/apache/geronimo/transaction/OnlineUserTransaction.java
Thu Oct 14 14:51:13 2004
@@ -0,0 +1,86 @@
+package org.apache.geronimo.transaction;
+
+import java.io.Serializable;
+import javax.transaction.UserTransaction;
+import javax.transaction.SystemException;
+import javax.transaction.NotSupportedException;
+import javax.transaction.HeuristicMixedException;
+import javax.transaction.HeuristicRollbackException;
+import javax.transaction.RollbackException;
+import javax.resource.ResourceException;
+
+import org.apache.geronimo.transaction.context.TransactionContextManager;
+import org.apache.geronimo.transaction.context.TransactionContext;
+import org.apache.geronimo.transaction.context.BeanTransactionContext;
+import org.apache.geronimo.transaction.context.UnspecifiedTransactionContext;
+
+/**
+ */
+public final class OnlineUserTransaction implements UserTransaction, Serializable {
+    private transient TransactionContextManager transactionContextManager;
+    private transient TrackedConnectionAssociator trackedConnectionAssociator;
+
+    boolean isActive() {
+        return transactionContextManager != null;
+    }
+
+    public void setUp(TransactionContextManager transactionContextManager, TrackedConnectionAssociator
trackedConnectionAssociator) {
+        this.transactionContextManager = transactionContextManager;
+        this.trackedConnectionAssociator = trackedConnectionAssociator;
+    }
+
+
+    public int getStatus() throws SystemException {
+        return transactionContextManager.getStatus();
+    }
+
+    public void setRollbackOnly() throws IllegalStateException, SystemException {
+        transactionContextManager.setRollbackOnly();
+    }
+
+    public void setTransactionTimeout(int seconds) throws SystemException {
+        transactionContextManager.setTransactionTimeout(seconds);
+    }
+
+    public void begin() throws NotSupportedException, SystemException {
+        transactionContextManager.newBeanTransactionContext();
+
+        if(trackedConnectionAssociator != null) {
+            try {
+                trackedConnectionAssociator.newTransaction();
+            } catch (ResourceException e) {
+                throw (SystemException)new SystemException().initCause(e);
+            }
+        }
+    }
+
+    public void commit() throws HeuristicMixedException, HeuristicRollbackException, IllegalStateException,
RollbackException, SecurityException, SystemException {
+        TransactionContext ctx = transactionContextManager.getContext();
+        if (ctx instanceof BeanTransactionContext == false) {
+            throw new IllegalStateException("Transaction has not been started");
+        }
+        BeanTransactionContext beanContext = (BeanTransactionContext) ctx;
+        try {
+            beanContext.commit();
+        } finally {
+            UnspecifiedTransactionContext oldContext = beanContext.getOldContext();
+            transactionContextManager.setContext(oldContext);
+            oldContext.resume();
+        }
+    }
+
+    public void rollback() throws IllegalStateException, SecurityException, SystemException
{
+        TransactionContext ctx = transactionContextManager.getContext();
+        if (ctx instanceof BeanTransactionContext == false) {
+            throw new IllegalStateException("Transaction has not been started");
+        }
+        BeanTransactionContext beanContext = (BeanTransactionContext) ctx;
+        try {
+            beanContext.rollback();
+        } finally {
+            UnspecifiedTransactionContext oldContext = beanContext.getOldContext();
+            transactionContextManager.setContext(oldContext);
+            oldContext.resume();
+        }
+    }
+}

Modified: geronimo/trunk/modules/transaction/src/java/org/apache/geronimo/transaction/TransactionManagerProxy.java
==============================================================================
--- geronimo/trunk/modules/transaction/src/java/org/apache/geronimo/transaction/TransactionManagerProxy.java
(original)
+++ geronimo/trunk/modules/transaction/src/java/org/apache/geronimo/transaction/TransactionManagerProxy.java
Thu Oct 14 14:51:13 2004
@@ -19,10 +19,10 @@
 
 import java.util.ArrayList;
 import java.util.Collection;
+import java.util.HashMap;
 import java.util.Iterator;
 import java.util.List;
 import java.util.Map;
-import java.util.HashMap;
 import javax.transaction.HeuristicMixedException;
 import javax.transaction.HeuristicRollbackException;
 import javax.transaction.InvalidTransactionException;
@@ -44,8 +44,6 @@
 import org.apache.geronimo.gbean.ReferenceCollectionEvent;
 import org.apache.geronimo.gbean.ReferenceCollectionListener;
 import org.apache.geronimo.gbean.WaitingException;
-import org.apache.geronimo.transaction.context.TransactionContext;
-import org.apache.geronimo.transaction.context.UnspecifiedTransactionContext;
 import org.apache.geronimo.transaction.manager.NamedXAResource;
 import org.apache.geronimo.transaction.manager.Recovery;
 import org.apache.geronimo.transaction.manager.ResourceManager;

Modified: geronimo/trunk/modules/transaction/src/java/org/apache/geronimo/transaction/UserTransactionImpl.java
==============================================================================
--- geronimo/trunk/modules/transaction/src/java/org/apache/geronimo/transaction/UserTransactionImpl.java
(original)
+++ geronimo/trunk/modules/transaction/src/java/org/apache/geronimo/transaction/UserTransactionImpl.java
Thu Oct 14 14:51:13 2004
@@ -19,7 +19,6 @@
 
 import java.io.Serializable;
 
-import javax.resource.ResourceException;
 import javax.transaction.HeuristicMixedException;
 import javax.transaction.HeuristicRollbackException;
 import javax.transaction.NotSupportedException;
@@ -28,9 +27,6 @@
 import javax.transaction.UserTransaction;
 
 import org.apache.geronimo.transaction.context.TransactionContextManager;
-import org.apache.geronimo.transaction.context.BeanTransactionContext;
-import org.apache.geronimo.transaction.context.TransactionContext;
-import org.apache.geronimo.transaction.context.UnspecifiedTransactionContext;
 
 /**
  * Implementation of UserTransaction for use in an EJB.
@@ -40,9 +36,6 @@
  * @version $Rev$ $Date$
  */
 public class UserTransactionImpl implements UserTransaction, Serializable {
-    private transient TransactionContextManager transactionContextManager;
-    private transient TrackedConnectionAssociator trackedConnectionAssociator;
-
     private final ThreadLocal state = new StateThreadLocal();
     private static class StateThreadLocal extends ThreadLocal implements Serializable {
         protected Object initialValue() {
@@ -56,8 +49,7 @@
 
     public void setUp(TransactionContextManager transactionContextManager, TrackedConnectionAssociator
trackedConnectionAssociator) {
         assert !isOnline() : "Only set the tx manager when UserTransaction is offline";
-        this.transactionContextManager = transactionContextManager;
-        this.trackedConnectionAssociator = trackedConnectionAssociator;
+        this.ONLINE.setUp(transactionContextManager, trackedConnectionAssociator);
     }
 
     public boolean isOnline() {
@@ -67,7 +59,7 @@
     public void setOnline(boolean online) {
         //too bad there's no implies operation
         // online implies transactionContextManager != null
-        assert !online || transactionContextManager != null : "online requires a tx manager";
+        assert !online || ONLINE.isActive() : "online requires a tx manager";
         state.set(online ? ONLINE : OFFLINE);
     }
 
@@ -99,62 +91,7 @@
         getUserTransaction().setTransactionTimeout(timeout);
     }
 
-    private final UserTransaction ONLINE = new OnlineUserTransaction();
-    private final class OnlineUserTransaction implements UserTransaction, Serializable {
-        public int getStatus() throws SystemException {
-            return transactionContextManager.getStatus();
-        }
-
-        public void setRollbackOnly() throws IllegalStateException, SystemException {
-            transactionContextManager.setRollbackOnly();
-        }
-
-        public void setTransactionTimeout(int seconds) throws SystemException {
-            transactionContextManager.setTransactionTimeout(seconds);
-        }
-
-        public void begin() throws NotSupportedException, SystemException {
-            transactionContextManager.newBeanTransactionContext();
-
-            if(trackedConnectionAssociator != null) {
-                try {
-                    trackedConnectionAssociator.newTransaction();
-                } catch (ResourceException e) {
-                    throw (SystemException)new SystemException().initCause(e);
-                }
-            }
-        }
-
-        public void commit() throws HeuristicMixedException, HeuristicRollbackException,
IllegalStateException, RollbackException, SecurityException, SystemException {
-            TransactionContext ctx = transactionContextManager.getContext();
-            if (ctx instanceof BeanTransactionContext == false) {
-                throw new IllegalStateException("Transaction has not been started");
-            }
-            BeanTransactionContext beanContext = (BeanTransactionContext) ctx;
-            try {
-                beanContext.commit();
-            } finally {
-                UnspecifiedTransactionContext oldContext = beanContext.getOldContext();
-                transactionContextManager.setContext(oldContext);
-                oldContext.resume();
-            }
-        }
-
-        public void rollback() throws IllegalStateException, SecurityException, SystemException
{
-            TransactionContext ctx = transactionContextManager.getContext();
-            if (ctx instanceof BeanTransactionContext == false) {
-                throw new IllegalStateException("Transaction has not been started");
-            }
-            BeanTransactionContext beanContext = (BeanTransactionContext) ctx;
-            try {
-                beanContext.rollback();
-            } finally {
-                UnspecifiedTransactionContext oldContext = beanContext.getOldContext();
-                transactionContextManager.setContext(oldContext);
-                oldContext.resume();
-            }
-        }
-    };
+    private final OnlineUserTransaction ONLINE = new OnlineUserTransaction();
 
     private static final UserTransaction OFFLINE = new OfflineUserTransaction();
     private static final class OfflineUserTransaction implements UserTransaction, Serializable
{

Modified: geronimo/trunk/modules/transaction/src/java/org/apache/geronimo/transaction/manager/Recovery.java
==============================================================================
--- geronimo/trunk/modules/transaction/src/java/org/apache/geronimo/transaction/manager/Recovery.java
(original)
+++ geronimo/trunk/modules/transaction/src/java/org/apache/geronimo/transaction/manager/Recovery.java
Thu Oct 14 14:51:13 2004
@@ -17,23 +17,12 @@
 
 package org.apache.geronimo.transaction.manager;
 
-import java.util.HashMap;
-import java.util.Iterator;
+import java.util.HashSet;
 import java.util.List;
 import java.util.Map;
 import java.util.Set;
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.Arrays;
-import java.util.HashSet;
-
-import javax.transaction.SystemException;
 import javax.transaction.xa.XAException;
-import javax.transaction.xa.XAResource;
 import javax.transaction.xa.Xid;
-
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
 
 /**
  *

Modified: geronimo/trunk/modules/transaction/src/java/org/apache/geronimo/transaction/manager/ResourceManager.java
==============================================================================
--- geronimo/trunk/modules/transaction/src/java/org/apache/geronimo/transaction/manager/ResourceManager.java
(original)
+++ geronimo/trunk/modules/transaction/src/java/org/apache/geronimo/transaction/manager/ResourceManager.java
Thu Oct 14 14:51:13 2004
@@ -1,7 +1,5 @@
 package org.apache.geronimo.transaction.manager;
 
-import java.util.List;
-
 import javax.transaction.SystemException;
 
 /**

Mime
View raw message