[jboss-svn-commits] JBL Code SVN: r19816 - in labs/jbosstm/branches/JBOSSTS_4_2_3_GA_SP/atsintegration: classes/com/arjuna/ats/internal/jbossatx/jta and 1 other directory.
jboss-svn-commits at lists.jboss.org
jboss-svn-commits at lists.jboss.org
Thu May 1 14:44:11 EDT 2008
Author: mmusgrov
Date: 2008-05-01 14:44:11 -0400 (Thu, 01 May 2008)
New Revision: 19816
Added:
labs/jbosstm/branches/JBOSSTS_4_2_3_GA_SP/atsintegration/classes/com/arjuna/ats/internal/jbossatx/jta/JMSProviderXAResourceRecovery.java
Modified:
labs/jbosstm/branches/JBOSSTS_4_2_3_GA_SP/atsintegration/build.xml
Log:
Included a JMS XA resource recovery provider for use within the AS. Please note that any resources corresponding to topics which do not have any durable subscriptions are not recoverable. This deficiency will be tested against, and addressed if requied, by the JBoss Messaging product
Resolves issue JBTM-279
Modified: labs/jbosstm/branches/JBOSSTS_4_2_3_GA_SP/atsintegration/build.xml
===================================================================
--- labs/jbosstm/branches/JBOSSTS_4_2_3_GA_SP/atsintegration/build.xml 2008-05-01 17:08:36 UTC (rev 19815)
+++ labs/jbosstm/branches/JBOSSTS_4_2_3_GA_SP/atsintegration/build.xml 2008-05-01 18:44:11 UTC (rev 19816)
@@ -121,7 +121,7 @@
<!-- libs from JBoss App Server installation. Note: these jars were refactored between
AS 4.x and AS 5.0. The list below is a hybrid to allow building against either version. -->
<property name="jboss.libs" value="jboss-common.jar jboss-system.jar jboss-jmx.jar jboss-logging-spi.jar jboss-common-core.jar jboss-j2se.jar jboss-system-jmx.jar"/>
- <property name="jboss.server.jta.libs" value="jmx-adaptor-plugin.jar jboss-transaction.jar"/>
+ <property name="jboss.server.jta.libs" value="jmx-adaptor-plugin.jar jboss-transaction.jar jboss.jar"/>
<property name="jboss.server.jts.libs" value="jboss-iiop.jar jacorb.jar"/>
<condition property="jboss.server.libs" value="${jboss.server.jta.libs} ${jboss.server.jts.libs}">
<isset property="com.hp.mwlabs.ts.build.jts"/>
Added: labs/jbosstm/branches/JBOSSTS_4_2_3_GA_SP/atsintegration/classes/com/arjuna/ats/internal/jbossatx/jta/JMSProviderXAResourceRecovery.java
===================================================================
--- labs/jbosstm/branches/JBOSSTS_4_2_3_GA_SP/atsintegration/classes/com/arjuna/ats/internal/jbossatx/jta/JMSProviderXAResourceRecovery.java (rev 0)
+++ labs/jbosstm/branches/JBOSSTS_4_2_3_GA_SP/atsintegration/classes/com/arjuna/ats/internal/jbossatx/jta/JMSProviderXAResourceRecovery.java 2008-05-01 18:44:11 UTC (rev 19816)
@@ -0,0 +1,111 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2006 to 2008, 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 com.arjuna.ats.internal.jbossatx.jta;
+
+import javax.transaction.xa.XAResource;
+
+import org.jboss.jms.recovery.XAResourceWrapper;
+
+import com.arjuna.ats.jta.recovery.XAResourceRecovery;
+
+import org.jboss.logging.Logger;
+
+/**
+ * This class provides recovery for JMS resources.
+
+ *
+ * To use this class, add an XAResourceRecovery entry in the jta section of jbossjta-properties.xml
+ * for JMS provider for which you need recovery, ensuring the value ends with ;<provider-name>
+ * i.e. the same value as is in the -ds.xml ProviderName element.
+ * You also need the XARecoveryModule enabled and appropriate values for nodeIdentifier and xaRecoveryNode set.
+ * See the JBossTS recovery guide if you are unclear on how the recovery system works.
+ *
+ * Note: This implementation expects to run inside the app server JVM.
+ *
+ * <properties depends="arjuna" name="jta">
+ * ...
+ * <property name="com.arjuna.ats.jta.recovery.XAResourceRecovery.JBMESSAGING1"
+ * value="com.arjuna.ats.internal.jbossatx.jta.JMSProviderXAResourceRecovery;java:/DefaultJMSProvider"/>
+ *
+ * @author <a href="adrian at jboss.com">Adrian Brock</a>
+ */
+public class JMSProviderXAResourceRecovery implements XAResourceRecovery
+{
+ private Logger log = org.jboss.logging.Logger.getLogger(JMSProviderXAResourceRecovery.class);
+
+ /** The jms provider name */
+ private String providerName;
+
+ /** The delegate XAResource */
+ private XAResourceWrapper wrapper;
+
+ /** Whether the XAResource is working */
+ private boolean working = false;
+
+ public boolean initialise(String p)
+ {
+ this.providerName = p;
+
+ if (log.isDebugEnabled())
+ log.debug("initialise: using provider " + p);
+
+ return true;
+ }
+
+ public boolean hasMoreResources()
+ {
+ if (working)
+ {
+ working = false; // reset ready for the next recovery scan
+
+ return false;
+ }
+
+ // Have we initialized yet?
+ if (wrapper == null)
+ {
+ wrapper = new XAResourceWrapper();
+ wrapper.setProviderName(providerName);
+ }
+
+ // Test the connection
+ try
+ {
+ wrapper.getTransactionTimeout();
+ working = true;
+ }
+ catch (Exception ignored)
+ {
+ if (log.isDebugEnabled())
+ log.debug("Still waiting for provider " + providerName);
+ }
+
+ // This will return false until we get
+ // a successful connection
+ return working;
+ }
+
+ public XAResource getXAResource()
+ {
+ return wrapper;
+ }
+}
More information about the jboss-svn-commits
mailing list