You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tomee.apache.org by dj...@apache.org on 2010/08/05 02:16:02 UTC

svn commit: r982436 - in /openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/core/mdb: InboundRecovery.java MdbContainer.java

Author: djencks
Date: Thu Aug  5 00:16:02 2010
New Revision: 982436

URL: http://svn.apache.org/viewvc?rev=982436&view=rev
Log:
OPENEJB-1320 support xa recovery on inbound resource adapters

Added:
    openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/core/mdb/InboundRecovery.java
Modified:
    openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/core/mdb/MdbContainer.java

Added: openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/core/mdb/InboundRecovery.java
URL: http://svn.apache.org/viewvc/openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/core/mdb/InboundRecovery.java?rev=982436&view=auto
==============================================================================
--- openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/core/mdb/InboundRecovery.java (added)
+++ openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/core/mdb/InboundRecovery.java Thu Aug  5 00:16:02 2010
@@ -0,0 +1,32 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *  http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+
+package org.apache.openejb.core.mdb;
+
+import javax.resource.spi.ActivationSpec;
+import javax.resource.spi.ResourceAdapter;
+import org.apache.openejb.OpenEJBException;
+
+/**
+ * @version $Rev:$ $Date:$
+ */
+public interface InboundRecovery {
+    void recover(ResourceAdapter resourceAdapter, ActivationSpec activationSpec, String containerId) throws OpenEJBException;
+}

Modified: openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/core/mdb/MdbContainer.java
URL: http://svn.apache.org/viewvc/openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/core/mdb/MdbContainer.java?rev=982436&r1=982435&r2=982436&view=diff
==============================================================================
--- openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/core/mdb/MdbContainer.java (original)
+++ openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/core/mdb/MdbContainer.java Thu Aug  5 00:16:02 2010
@@ -81,6 +81,7 @@ public class MdbContainer implements Rpc
 
     private final ConcurrentMap<Object, CoreDeploymentInfo> deployments = new ConcurrentHashMap<Object, CoreDeploymentInfo>();
     private final XAResourceWrapper xaResourceWrapper;
+    private final InboundRecovery inboundRecovery;
 
     public MdbContainer(Object containerID, SecurityService securityService, ResourceAdapter resourceAdapter, Class messageListenerInterface, Class activationSpecClass, int instanceLimit) {
         this.containerID = containerID;
@@ -90,6 +91,7 @@ public class MdbContainer implements Rpc
         this.activationSpecClass = activationSpecClass;
         this.instanceLimit = instanceLimit;
         xaResourceWrapper = SystemInstance.get().getComponent(XAResourceWrapper.class);
+        inboundRecovery = SystemInstance.get().getComponent(InboundRecovery.class);
     }
 
     public DeploymentInfo [] deployments() {
@@ -132,6 +134,10 @@ public class MdbContainer implements Rpc
         // create the activation spec
         ActivationSpec activationSpec = createActivationSpec(deploymentInfo);
 
+        if (inboundRecovery != null) {
+            inboundRecovery.recover(resourceAdapter, activationSpec, containerID.toString());
+        }
+        
         Options options = new Options(deploymentInfo.getProperties());
         int instanceLimit = options.get("InstanceLimit", this.instanceLimit);
         // create the message endpoint