geronimo-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From djen...@apache.org
Subject svn commit: r983159 - in /geronimo/server/branches/2.1/plugins/openejb: ./ geronimo-openejb/src/main/java/org/apache/geronimo/openejb/GeronimoInboundRecovery.java geronimo-openejb/src/main/java/org/apache/geronimo/openejb/OpenEjbSystemGBean.java
Date Sat, 07 Aug 2010 01:02:19 GMT
Author: djencks
Date: Sat Aug  7 01:02:19 2010
New Revision: 983159

URL: http://svn.apache.org/viewvc?rev=983159&view=rev
Log:
GERONIMO-5501 support xa recovery of inbound resource adapters

Added:
    geronimo/server/branches/2.1/plugins/openejb/geronimo-openejb/src/main/java/org/apache/geronimo/openejb/GeronimoInboundRecovery.java
      - copied, changed from r982438, geronimo/server/trunk/plugins/openejb/geronimo-openejb/src/main/java/org/apache/geronimo/openejb/GeronimoInboundRecovery.java
Modified:
    geronimo/server/branches/2.1/plugins/openejb/   (props changed)
    geronimo/server/branches/2.1/plugins/openejb/geronimo-openejb/src/main/java/org/apache/geronimo/openejb/OpenEjbSystemGBean.java

Propchange: geronimo/server/branches/2.1/plugins/openejb/
------------------------------------------------------------------------------
--- svn:mergeinfo (added)
+++ svn:mergeinfo Sat Aug  7 01:02:19 2010
@@ -0,0 +1,2 @@
+/geronimo/server/branches/2.1.4/plugins/openejb:756973
+/geronimo/server/trunk/plugins/openejb:695597,695602,982438,983150

Copied: geronimo/server/branches/2.1/plugins/openejb/geronimo-openejb/src/main/java/org/apache/geronimo/openejb/GeronimoInboundRecovery.java
(from r982438, geronimo/server/trunk/plugins/openejb/geronimo-openejb/src/main/java/org/apache/geronimo/openejb/GeronimoInboundRecovery.java)
URL: http://svn.apache.org/viewvc/geronimo/server/branches/2.1/plugins/openejb/geronimo-openejb/src/main/java/org/apache/geronimo/openejb/GeronimoInboundRecovery.java?p2=geronimo/server/branches/2.1/plugins/openejb/geronimo-openejb/src/main/java/org/apache/geronimo/openejb/GeronimoInboundRecovery.java&p1=geronimo/server/trunk/plugins/openejb/geronimo-openejb/src/main/java/org/apache/geronimo/openejb/GeronimoInboundRecovery.java&r1=982438&r2=983159&rev=983159&view=diff
==============================================================================
--- geronimo/server/trunk/plugins/openejb/geronimo-openejb/src/main/java/org/apache/geronimo/openejb/GeronimoInboundRecovery.java
(original)
+++ geronimo/server/branches/2.1/plugins/openejb/geronimo-openejb/src/main/java/org/apache/geronimo/openejb/GeronimoInboundRecovery.java
Sat Aug  7 01:02:19 2010
@@ -20,9 +20,14 @@
 
 package org.apache.geronimo.openejb;
 
+import javax.resource.ResourceException;
 import javax.resource.spi.ActivationSpec;
 import javax.resource.spi.ResourceAdapter;
+import javax.transaction.xa.XAResource;
 import org.apache.geronimo.connector.ResourceAdapterWrapper;
+import org.apache.geronimo.transaction.manager.NamedXAResource;
+import org.apache.geronimo.transaction.manager.RecoverableTransactionManager;
+import org.apache.geronimo.transaction.manager.WrapperNamedXAResource;
 import org.apache.openejb.OpenEJBException;
 import org.apache.openejb.core.mdb.InboundRecovery;
 
@@ -31,7 +36,22 @@ import org.apache.openejb.core.mdb.Inbou
  */
 public class GeronimoInboundRecovery implements InboundRecovery {
 
+    private final RecoverableTransactionManager transactionManager;
+
+    public GeronimoInboundRecovery(RecoverableTransactionManager transactionManager) {
+        this.transactionManager = transactionManager;
+    }
+
     public void recover(ResourceAdapter resourceAdapter, ActivationSpec activationSpec, String
containerId) throws OpenEJBException {
-        ((ResourceAdapterWrapper)resourceAdapter).doRecovery(activationSpec, containerId);
+        try {
+            XAResource[] xaress = resourceAdapter.getXAResources(new ActivationSpec[] {activationSpec});
+            if (xaress == null || xaress.length == 0) {
+                return;
+            }
+            NamedXAResource xares = new WrapperNamedXAResource(xaress[0], containerId);
+            transactionManager.recoverResourceManager(xares);
+        } catch (ResourceException e) {
+            throw new OpenEJBException("Could not recover resource manager", e);
+        }
     }
 }

Modified: geronimo/server/branches/2.1/plugins/openejb/geronimo-openejb/src/main/java/org/apache/geronimo/openejb/OpenEjbSystemGBean.java
URL: http://svn.apache.org/viewvc/geronimo/server/branches/2.1/plugins/openejb/geronimo-openejb/src/main/java/org/apache/geronimo/openejb/OpenEjbSystemGBean.java?rev=983159&r1=983158&r2=983159&view=diff
==============================================================================
--- geronimo/server/branches/2.1/plugins/openejb/geronimo-openejb/src/main/java/org/apache/geronimo/openejb/OpenEjbSystemGBean.java
(original)
+++ geronimo/server/branches/2.1/plugins/openejb/geronimo-openejb/src/main/java/org/apache/geronimo/openejb/OpenEjbSystemGBean.java
Sat Aug  7 01:02:19 2010
@@ -45,6 +45,7 @@ import org.apache.geronimo.gbean.Referen
 import org.apache.geronimo.kernel.GBeanNotFoundException;
 import org.apache.geronimo.kernel.Kernel;
 import org.apache.geronimo.persistence.PersistenceUnitGBean;
+import org.apache.geronimo.transaction.manager.RecoverableTransactionManager;
 import org.apache.openejb.Container;
 import org.apache.openejb.DeploymentInfo;
 import org.apache.openejb.NoSuchApplicationException;
@@ -65,6 +66,7 @@ import org.apache.openejb.config.ClientM
 import org.apache.openejb.config.ConfigurationFactory;
 import org.apache.openejb.config.EjbModule;
 import org.apache.openejb.core.ServerFederation;
+import org.apache.openejb.core.mdb.InboundRecovery;
 import org.apache.openejb.loader.SystemInstance;
 import org.apache.openejb.spi.ApplicationServer;
 import org.apache.openejb.spi.ContainerSystem;
@@ -87,10 +89,10 @@ public class OpenEjbSystemGBean implemen
     // Once we have a set, we ignore any additional notifications. 
     private ORB orb;
 
-    public OpenEjbSystemGBean(TransactionManager transactionManager) throws Exception {
+    public OpenEjbSystemGBean(RecoverableTransactionManager transactionManager) throws Exception
{
         this(transactionManager, null, null, null, OpenEjbSystemGBean.class.getClassLoader());
     }
-    public OpenEjbSystemGBean(TransactionManager transactionManager, Collection<ResourceAdapterWrapper>
resourceAdapters, Collection<PersistenceUnitGBean> persistenceUnitGBeans, Kernel kernel,
ClassLoader classLoader) throws Exception {
+    public OpenEjbSystemGBean(RecoverableTransactionManager transactionManager, Collection<ResourceAdapterWrapper>
resourceAdapters, Collection<PersistenceUnitGBean> persistenceUnitGBeans, Kernel kernel,
ClassLoader classLoader) throws Exception {
         this.kernel = kernel;
         this.classLoader = classLoader;
 
@@ -124,6 +126,8 @@ public class OpenEjbSystemGBean implemen
         transactionServiceInfo.service = "TransactionManager";
         assembler.createTransactionManager(transactionServiceInfo);
 
+        SystemInstance.get().setComponent(InboundRecovery.class, new GeronimoInboundRecovery(transactionManager));
+
         // install security service
         SecurityService securityService = new GeronimoSecurityService();
         SecurityServiceInfo securityServiceInfo = new SecurityServiceInfo();
@@ -415,7 +419,7 @@ public class OpenEjbSystemGBean implemen
 
     static {
         GBeanInfoBuilder infoBuilder = GBeanInfoBuilder.createStatic(OpenEjbSystemGBean.class);
-        infoBuilder.addReference("TransactionManager", TransactionManager.class);
+        infoBuilder.addReference("TransactionManager", RecoverableTransactionManager.class);
         infoBuilder.addReference("ResourceAdapterWrappers", ResourceAdapterWrapper.class);
         infoBuilder.addReference("PersistenceUnitGBeans", PersistenceUnitGBean.class);
         infoBuilder.addAttribute("kernel", Kernel.class, false);



Mime
View raw message