[jboss-cvs] JBossAS SVN: r94030 - branches/JBPAPP_5_0/connector/src/main/org/jboss/resource/adapter/jms.

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Fri Sep 25 14:44:55 EDT 2009


Author: jesper.pedersen
Date: 2009-09-25 14:44:55 -0400 (Fri, 25 Sep 2009)
New Revision: 94030

Modified:
   branches/JBPAPP_5_0/connector/src/main/org/jboss/resource/adapter/jms/JmsXAResource.java
Log:
[JBPAPP-2856] Backport JBAS-7139: JmsXAResource not calculating isSameRM correctly

Modified: branches/JBPAPP_5_0/connector/src/main/org/jboss/resource/adapter/jms/JmsXAResource.java
===================================================================
--- branches/JBPAPP_5_0/connector/src/main/org/jboss/resource/adapter/jms/JmsXAResource.java	2009-09-25 18:38:26 UTC (rev 94029)
+++ branches/JBPAPP_5_0/connector/src/main/org/jboss/resource/adapter/jms/JmsXAResource.java	2009-09-25 18:44:55 UTC (rev 94030)
@@ -1,24 +1,24 @@
 /*
- * JBoss, Home of Professional Open Source.
- * Copyright 2006, Red Hat Middleware LLC, and individual contributors
- * as indicated by the @author tags. See the copyright.txt file in the
- * distribution for a full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
+* JBoss, Home of Professional Open Source
+* Copyright 2007, JBoss Inc., and individual contributors as indicated
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+*/
 package org.jboss.resource.adapter.jms;
 
 import javax.transaction.xa.XAException;
@@ -79,17 +79,41 @@
 
    public int prepare(Xid xid) throws XAException
    {
-      return xaResource.prepare(xid);
+      managedConnection.lock();
+      try
+      {
+         return xaResource.prepare(xid);
+      }
+      finally
+      {
+         managedConnection.unlock();
+      }
    }
 
    public void commit(Xid xid, boolean onePhase) throws XAException
    {
-      xaResource.commit(xid, onePhase);
+      managedConnection.lock();
+      try
+      {
+         xaResource.commit(xid, onePhase);
+      }
+      finally
+      {
+         managedConnection.unlock();
+      }
    }
 
    public void rollback(Xid xid) throws XAException
    {
-      xaResource.rollback(xid);
+      managedConnection.lock();
+      try
+      {
+         xaResource.rollback(xid);
+      }
+      finally
+      {
+         managedConnection.unlock();
+      }
    }
 
    public void forget(Xid xid) throws XAException
@@ -105,8 +129,16 @@
       }
    }
 
+   public XAResource getUnderlyingXAResource()
+   {
+      return xaResource;
+   }
+  
    public boolean isSameRM(XAResource xaRes) throws XAException
    {
+      if (xaRes instanceof JmsXAResource)
+         xaRes = ((JmsXAResource) xaRes).getUnderlyingXAResource();
+  
       return xaResource.isSameRM(xaRes);
    }
 




More information about the jboss-cvs-commits mailing list