[jboss-svn-commits] JBL Code SVN: r18237 - in labs/jbossesb/branches/JBESB_4_2_1_GA_CP/product: rosetta/src/org/jboss/internal/soa/esb/couriers and 3 other directories.
jboss-svn-commits at lists.jboss.org
jboss-svn-commits at lists.jboss.org
Fri Feb 1 01:32:55 EST 2008
Author: mark.little at jboss.com
Date: 2008-02-01 01:32:55 -0500 (Fri, 01 Feb 2008)
New Revision: 18237
Added:
labs/jbossesb/branches/JBESB_4_2_1_GA_CP/product/rosetta/src/org/jboss/internal/soa/esb/rosetta/pooling/xa/
labs/jbossesb/branches/JBESB_4_2_1_GA_CP/product/rosetta/src/org/jboss/internal/soa/esb/rosetta/pooling/xa/XaJmsConnectionPool.java
labs/jbossesb/branches/JBESB_4_2_1_GA_CP/product/rosetta/src/org/jboss/internal/soa/esb/rosetta/pooling/xa/XaJmsConnectionPoolContainer.java
Modified:
labs/jbossesb/branches/JBESB_4_2_1_GA_CP/product/build.xml
labs/jbossesb/branches/JBESB_4_2_1_GA_CP/product/rosetta/src/org/jboss/internal/soa/esb/couriers/JmsCourier.java
labs/jbossesb/branches/JBESB_4_2_1_GA_CP/product/rosetta/src/org/jboss/internal/soa/esb/rosetta/pooling/JmsConnectionPool.java
labs/jbossesb/branches/JBESB_4_2_1_GA_CP/product/rosetta/src/org/jboss/internal/soa/esb/rosetta/pooling/JmsConnectionPoolContainer.java
labs/jbossesb/branches/JBESB_4_2_1_GA_CP/product/rosetta/src/org/jboss/soa/esb/common/JBossESBPropertyService.java
labs/jbossesb/branches/JBESB_4_2_1_GA_CP/product/rosetta/src/org/jboss/soa/esb/common/TransactionStrategy.java
labs/jbossesb/branches/JBESB_4_2_1_GA_CP/product/skip.properties-example
Log:
http://jira.jboss.com/jira/browse/JBESB-1438
Modified: labs/jbossesb/branches/JBESB_4_2_1_GA_CP/product/build.xml
===================================================================
--- labs/jbossesb/branches/JBESB_4_2_1_GA_CP/product/build.xml 2008-02-01 06:15:14 UTC (rev 18236)
+++ labs/jbossesb/branches/JBESB_4_2_1_GA_CP/product/build.xml 2008-02-01 06:32:55 UTC (rev 18237)
@@ -128,19 +128,19 @@
<!-- Test targets -->
- <target name="esb.test" depends="org.jboss.esb.test.configure-default, org.jboss.esb.test"/>
+ <target name="esb.test" depends="org.jboss.esb.test.configure-default, org.jboss.esb.test" unless="skip.tests"/>
<target name="org.jboss.esb.test.configure-default">
<property name="tests.to.run" value="*" />
</target>
- <target name="esb.testx" depends="org.jboss.esb.test.configure-tests, org.jboss.esb.test"/>
+ <target name="esb.testx" depends="org.jboss.esb.test.configure-tests, org.jboss.esb.test" unless="skip.tests"/>
<target name="org.jboss.esb.test.configure-tests">
<input addproperty="tests.to.run" message="Enter the name of the class(es) to be tested. Wildcards Supported. No need to specify the 'UnitTest' suffix:" />
</target>
- <target name="org.jboss.esb.test" depends="org.jboss.esb.jar">
+ <target name="org.jboss.esb.test" depends="org.jboss.esb.jar" unless="skip.tests">
<echo message="Testing of modules, using unit and functional tests"/>
<ant dir="rosetta" target="org.jboss.esb.rosetta.test"/>
<ant dir="services" target="test"/>
@@ -156,7 +156,7 @@
</target>
<!-- Integration test targets -->
- <target name="org.jboss.esb.integration.test" depends="org.jboss.esb.compile">
+ <target name="org.jboss.esb.integration.test" depends="org.jboss.esb.compile" unless="skip.tests">
<echo message="Testing of modules, using unit, functional and integration tests"/>
<ant dir="rosetta">
<target name="org.jboss.esb.rosetta.integration.test"/>
Modified: labs/jbossesb/branches/JBESB_4_2_1_GA_CP/product/rosetta/src/org/jboss/internal/soa/esb/couriers/JmsCourier.java
===================================================================
--- labs/jbossesb/branches/JBESB_4_2_1_GA_CP/product/rosetta/src/org/jboss/internal/soa/esb/couriers/JmsCourier.java 2008-02-01 06:15:14 UTC (rev 18236)
+++ labs/jbossesb/branches/JBESB_4_2_1_GA_CP/product/rosetta/src/org/jboss/internal/soa/esb/couriers/JmsCourier.java 2008-02-01 06:32:55 UTC (rev 18237)
@@ -46,6 +46,8 @@
import org.jboss.internal.soa.esb.rosetta.pooling.ConnectionException;
import org.jboss.internal.soa.esb.rosetta.pooling.JmsConnectionPool;
import org.jboss.internal.soa.esb.rosetta.pooling.JmsConnectionPoolContainer;
+import org.jboss.internal.soa.esb.rosetta.pooling.xa.XaJmsConnectionPool;
+import org.jboss.internal.soa.esb.rosetta.pooling.xa.XaJmsConnectionPoolContainer;
import org.jboss.soa.esb.ConfigurationException;
import org.jboss.soa.esb.addressing.MalformedEPRException;
import org.jboss.soa.esb.addressing.eprs.JMSEpr;
@@ -142,13 +144,15 @@
}
public Session getJmsSession(final int acknowledgeMode) throws CourierException {
+ reset();
+
if(jmsSession == null) {
synchronized(this) {
try
{
- TransactionStrategy txStrategy = TransactionStrategy.getStrategy();
- Object txHandle = ((txStrategy == null) ? null : txStrategy.getTransaction());
- boolean isActive = ((txStrategy == null) ? false : txStrategy.isActive());
+ TransactionStrategy txStrategy = TransactionStrategy.getTransactionStrategy(true);
+ Object txHandle = txStrategy.getTransaction();
+ boolean isActive = txStrategy.isActive();
transactional = (txHandle != null);
@@ -264,9 +268,9 @@
try
{
- TransactionStrategy txStrategy = TransactionStrategy.getStrategy();
- Object txHandle = ((txStrategy == null) ? null : txStrategy.getTransaction());
- boolean isActive = ((txStrategy == null) ? false : txStrategy.isActive());
+ TransactionStrategy txStrategy = TransactionStrategy.getTransactionStrategy(true);
+ Object txHandle = txStrategy.getTransaction();
+ boolean isActive = txStrategy.isActive();
transactional = (txHandle != null);
@@ -276,10 +280,6 @@
* associated with the transaction.
*/
- /*
- * MessageAwareListener will catch exceptions and roll back the transaction.
- */
-
if (transactional && !isActive)
{
throw new CourierException("Associated transaction is no longer active!");
@@ -289,7 +289,9 @@
{
throw new CourierException(ex);
}
-
+
+ reset();
+
if (_messageProducer == null) {
try {
createMessageProducer();
@@ -306,7 +308,7 @@
message.setStringProperty(key, kvp.getValue());
}
}
-
+
sendMessage(message);
if ( jmsSession.getTransacted() && !transactional )
jmsSession.commit();
@@ -375,6 +377,8 @@
private void createMessageProducer() throws CourierException, NamingContextException {
Context oJndiCtx = null;
+ reset();
+
if (_messageProducer == null) {
synchronized(this) {
if (_messageProducer == null) {
@@ -435,14 +439,9 @@
} // ________________________________
private JmsConnectionPool getConnectionPool() throws ConnectionException {
- /*
- * We need to ignore the pool if we are being used within the scope of
- * a global transaction. However, the pool conveniently wraps the JNDI
- * lookup and configuration. Rather than refactor that out, for now we
- * "work around" it.
- */
+ reset();
- if ((jmsConnectionPool == null) || (transactional)) {
+ if (jmsConnectionPool == null) {
synchronized(this) {
if(jmsConnectionPool == null) {
String sFactoryClass;
@@ -471,7 +470,25 @@
* Needs to be a one-shot instance if transactional.
*/
- jmsConnectionPool = JmsConnectionPoolContainer.getPool(properties, sFactoryClass, sType, username, password, transacted, transactional);
+ Object tx = null;
+
+ try
+ {
+ TransactionStrategy txS = TransactionStrategy.getTransactionStrategy(true);
+
+ tx = txS.getTransaction();
+ }
+ catch (TransactionStrategyException ex)
+ {
+ _logger.warn("Problem getting transaction strategy: ", ex);
+
+ throw new ConnectionException(ex);
+ }
+
+ if (tx == null)
+ jmsConnectionPool = JmsConnectionPoolContainer.getPool(properties, sFactoryClass, sType, username, password, transacted);
+ else
+ jmsConnectionPool = XaJmsConnectionPoolContainer.getPool(properties, sFactoryClass, sType, username, password, transacted, tx);
}
}
}
@@ -479,6 +496,29 @@
return jmsConnectionPool;
}
+ private void reset ()
+ {
+ /*
+ * Are we in a global transaction?
+ */
+
+ if (jmsConnectionPool instanceof XaJmsConnectionPool)
+ {
+ /*
+ * If the global transaction has terminated then this pool instance has been
+ * closed and we need to get another one.
+ */
+
+ if (!((XaJmsConnectionPool) jmsConnectionPool).active())
+ {
+ jmsConnectionPool = null;
+ _messageProducer = null;
+ _messageConsumer = null;
+ jmsSession = null;
+ }
+ }
+ }
+
public Message pickup(long millis) throws CourierException, CourierTimeoutException {
javax.jms.Message jmsMessage = pickupPayload(millis);
@@ -562,6 +602,8 @@
private void createMessageConsumer() throws CourierException, ConfigurationException, MalformedEPRException, NamingContextException {
Context oJndiCtx = null;
+ reset();
+
if (_messageConsumer == null) {
synchronized(this) {
if (_messageConsumer == null) {
Modified: labs/jbossesb/branches/JBESB_4_2_1_GA_CP/product/rosetta/src/org/jboss/internal/soa/esb/rosetta/pooling/JmsConnectionPool.java
===================================================================
--- labs/jbossesb/branches/JBESB_4_2_1_GA_CP/product/rosetta/src/org/jboss/internal/soa/esb/rosetta/pooling/JmsConnectionPool.java 2008-02-01 06:15:14 UTC (rev 18236)
+++ labs/jbossesb/branches/JBESB_4_2_1_GA_CP/product/rosetta/src/org/jboss/internal/soa/esb/rosetta/pooling/JmsConnectionPool.java 2008-02-01 06:32:55 UTC (rev 18237)
@@ -80,7 +80,7 @@
private Map<Integer,ArrayList<Session>> inUseSessionsMap = new HashMap<Integer,ArrayList<Session>>();
/** Reference to a Queue or Topic Connection, we only need one per pool */
- private Connection jmsConnection = null;
+ protected Connection jmsConnection = null;
/** The Indentifier of the pool */
private Map<String, String> poolKey;
@@ -135,27 +135,10 @@
try {
String connectionFactoryString = poolKey.get(JMSEpr.CONNECTION_FACTORY_TAG);
Object factoryConnection=null;
- try {
- /*
- * For XA connections, use java:/JmsXA which should return a wrapped
- * XAConnectionFactory instance, which will be the base for the
- * XAQueueConnectionFactory or XATopicConnectionFactory.
- */
-
- try
- {
- if (TransactionStrategy.getTransactionStrategy(true).getTransaction() != null)
- {
- if ("XAConnectionFactory".equals(connectionFactoryString))
- connectionFactoryString = "java:/JmsXA";
- }
- }
- catch (TransactionStrategyException ex)
- {
- logger.warn("Could not determine transaction strategy!", ex);
- }
- factoryConnection = jndiContext.lookup(connectionFactoryString);
+ try
+ {
+ factoryConnection = jndiContext.lookup(overrideName(connectionFactoryString));
} catch (NamingException ne) {
logger.info("Received NamingException, refreshing context.");
jndiContext = NamingContextPool.replaceNamingContext(jndiContext, JmsConnectionPoolContainer.getJndiEnvironment(poolKey));
@@ -174,29 +157,8 @@
jmsConnection = useJMSSecurity ? factory.createTopicConnection(username,password): factory.createTopicConnection();
}
- TransactionStrategy txStrategy = TransactionStrategy.getStrategy();
+ addExceptionListener();
- /*
- * It is illegal to set ExceptionListeners if we are within a transaction.
- */
-
- try
- {
- if ((txStrategy != null) && (txStrategy.getTransaction() == null))
- {
- jmsConnection.setExceptionListener(new ExceptionListener() {
- public void onException(JMSException arg0)
- {
- removeSessionPool() ;
- }
- }) ;
- }
- }
- catch (TransactionStrategyException ex)
- {
- throw new ConnectionException(ex);
- }
-
jmsConnection.start();
} finally {
NamingContextPool.releaseNamingContext(jndiContext) ;
@@ -413,6 +375,21 @@
return inUseSessionsMap.get(acknowledgeMode).size();
}
+ protected String overrideName (String name) throws ConnectionException
+ {
+ return name;
+ }
+
+ protected void addExceptionListener () throws JMSException, ConnectionException
+ {
+ jmsConnection.setExceptionListener(new ExceptionListener() {
+ public void onException(JMSException arg0)
+ {
+ removeSessionPool() ;
+ }
+ }) ;
+ }
+
static
{
PropertyManager prop = ModulePropertyManager.getPropertyManager(ModulePropertyManager.TRANSPORTS_MODULE);
Modified: labs/jbossesb/branches/JBESB_4_2_1_GA_CP/product/rosetta/src/org/jboss/internal/soa/esb/rosetta/pooling/JmsConnectionPoolContainer.java
===================================================================
--- labs/jbossesb/branches/JBESB_4_2_1_GA_CP/product/rosetta/src/org/jboss/internal/soa/esb/rosetta/pooling/JmsConnectionPoolContainer.java 2008-02-01 06:15:14 UTC (rev 18236)
+++ labs/jbossesb/branches/JBESB_4_2_1_GA_CP/product/rosetta/src/org/jboss/internal/soa/esb/rosetta/pooling/JmsConnectionPoolContainer.java 2008-02-01 06:32:55 UTC (rev 18237)
@@ -43,7 +43,7 @@
*/
public class JmsConnectionPoolContainer{
- private static Logger logger = Logger.getLogger(JmsConnectionPoolContainer.class);
+ protected static Logger logger = Logger.getLogger(JmsConnectionPoolContainer.class);
/**
* The lifecycle resource factory.
@@ -56,6 +56,8 @@
new LifecycleResource<Map<Map<String, String>, JmsConnectionPool>>(lifecycleJMSPoolFactory,
LifecyclePriorities.JMS_CONNECTION_POOL_PRIORITY) ;
+ protected static final HashMap<Object, JmsConnectionPool> transactions = new HashMap<Object, JmsConnectionPool>();
+
/**
* Returns the pool given a JMSEpr.
*
@@ -76,7 +78,7 @@
/**
* Returns the pool given the identifiers for the JMS provider.
*
- * @param enviroment - JNDI evironment for which a JMSConnectionPool should be retreived
+ * @param enviroment - JNDI environment for which a JMSConnectionPool should be retreived
* @param connectionFactory - connectionfactory for which a JMSConnectionPool should be retreived
* @param destinationType - destinationType(Queue or Topic) for which a JMSConnectionPool should be retreived
* @return <code>JmsConnectionPool</code>
@@ -95,13 +97,6 @@
}
- public static JmsConnectionPool getPool(Properties enviroment, String connectionFactory, String destinationType,
- final String username, final String password, final boolean transacted)
- throws ConnectionException
- {
- return getPool(enviroment, connectionFactory, destinationType, username, password, transacted, false);
- }
-
/**
* Returns the pool given the identifiers for the JMS provider.
*
@@ -115,31 +110,19 @@
* @throws ConnectionException
*/
public static JmsConnectionPool getPool(Properties enviroment, String connectionFactory, String destinationType,
- final String username, final String password, final boolean transacted, final boolean ignore)
+ final String username, final String password, final boolean transacted)
throws ConnectionException
{
Map<String,String> poolKey = createPoolKey(enviroment, connectionFactory, destinationType, username, password, transacted);
final Map<Map<String, String>, JmsConnectionPool> poolMap = getMap() ;
- if (poolMap.containsKey(poolKey) && !ignore) {
+ if (poolMap.containsKey(poolKey)) {
return poolMap.get(poolKey);
} else {
JmsConnectionPool pool = new JmsConnectionPool(poolKey);
- /*
- * Horrible, but means we don't have to rewrite the pool code at this stage!
- */
+ poolMap.put(poolKey, pool);
- if (!ignore)
- {
- /*
- * Put it into the pool unless this is a one-shot connection, e.g., for
- * use in a global transaction.
- */
-
- poolMap.put(poolKey, pool);
- }
-
return pool;
}
}
@@ -286,4 +269,4 @@
}
}
}
-}
+}
\ No newline at end of file
Added: labs/jbossesb/branches/JBESB_4_2_1_GA_CP/product/rosetta/src/org/jboss/internal/soa/esb/rosetta/pooling/xa/XaJmsConnectionPool.java
===================================================================
--- labs/jbossesb/branches/JBESB_4_2_1_GA_CP/product/rosetta/src/org/jboss/internal/soa/esb/rosetta/pooling/xa/XaJmsConnectionPool.java (rev 0)
+++ labs/jbossesb/branches/JBESB_4_2_1_GA_CP/product/rosetta/src/org/jboss/internal/soa/esb/rosetta/pooling/xa/XaJmsConnectionPool.java 2008-02-01 06:32:55 UTC (rev 18237)
@@ -0,0 +1,108 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2006, 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.internal.soa.esb.rosetta.pooling.xa;
+
+import java.util.Map;
+
+import javax.jms.ExceptionListener;
+import javax.jms.JMSException;
+
+import org.jboss.internal.soa.esb.rosetta.pooling.ConnectionException;
+import org.jboss.internal.soa.esb.rosetta.pooling.JmsConnectionPool;
+import org.jboss.soa.esb.common.TransactionStrategy;
+import org.jboss.soa.esb.common.TransactionStrategyException;
+
+public class XaJmsConnectionPool extends JmsConnectionPool
+{
+ public XaJmsConnectionPool(Map<String, String> poolKey)
+ {
+ super(poolKey);
+ }
+
+ public XaJmsConnectionPool(Map<String, String> poolKey, int poolSize, int sleepTime)
+ {
+ super(poolKey, poolSize, sleepTime);
+ }
+
+ public boolean active ()
+ {
+ return _active;
+ }
+
+ public void terminated ()
+ {
+ _active = false;
+ }
+
+ protected String overrideName (String name) throws ConnectionException
+ {
+ try
+ {
+ /*
+ * If there is a global transaction in place then make sure
+ * we grab the right connection, irrespective of the provider
+ * info - assume JCA.
+ */
+
+ if (TransactionStrategy.getTransactionStrategy(true).getTransaction() != null)
+ {
+ if ("XAConnectionFactory".equals(name))
+ return "java:/JmsXA";
+ }
+
+ return name;
+ }
+ catch (TransactionStrategyException ex)
+ {
+ throw new ConnectionException(ex);
+ }
+ }
+
+ protected void addExceptionListener () throws JMSException, ConnectionException
+ {
+ /*
+ * It is illegal to set ExceptionListeners if we are within a transaction.
+ */
+
+ try
+ {
+ TransactionStrategy txStrategy = TransactionStrategy.getTransactionStrategy(true);
+
+ if ((txStrategy != null) && (txStrategy.getTransaction() == null))
+ {
+ jmsConnection.setExceptionListener(new ExceptionListener() {
+ public void onException(JMSException arg0)
+ {
+ removeSessionPool() ;
+ }
+ }) ;
+ }
+ }
+ catch (TransactionStrategyException ex)
+ {
+ throw new ConnectionException(ex);
+ }
+ }
+
+ private boolean _active = true;
+
+}
Added: labs/jbossesb/branches/JBESB_4_2_1_GA_CP/product/rosetta/src/org/jboss/internal/soa/esb/rosetta/pooling/xa/XaJmsConnectionPoolContainer.java
===================================================================
--- labs/jbossesb/branches/JBESB_4_2_1_GA_CP/product/rosetta/src/org/jboss/internal/soa/esb/rosetta/pooling/xa/XaJmsConnectionPoolContainer.java (rev 0)
+++ labs/jbossesb/branches/JBESB_4_2_1_GA_CP/product/rosetta/src/org/jboss/internal/soa/esb/rosetta/pooling/xa/XaJmsConnectionPoolContainer.java 2008-02-01 06:32:55 UTC (rev 18237)
@@ -0,0 +1,111 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2006, 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.internal.soa.esb.rosetta.pooling.xa;
+
+import java.util.HashMap;
+import java.util.Map;
+import java.util.Properties;
+
+import javax.transaction.Synchronization;
+
+import org.jboss.internal.soa.esb.rosetta.pooling.ConnectionException;
+import org.jboss.internal.soa.esb.rosetta.pooling.JmsConnectionPool;
+import org.jboss.internal.soa.esb.rosetta.pooling.JmsConnectionPoolContainer;
+import org.jboss.internal.soa.esb.rosetta.pooling.xa.XaJmsConnectionPool;
+import org.jboss.soa.esb.common.TransactionStrategy;
+import org.jboss.soa.esb.common.TransactionStrategyException;
+
+public class XaJmsConnectionPoolContainer extends JmsConnectionPoolContainer
+{
+
+ public static JmsConnectionPool getPool (Properties enviroment,
+ String connectionFactory, String destinationType,
+ final String username, final String password,
+ final boolean transacted, final Object transaction)
+ throws ConnectionException
+ {
+ synchronized (transactions)
+ {
+ JmsConnectionPool connection = transactions.get(transaction);
+
+ if (connection == null)
+ {
+ Map<String, String> poolKey = createPoolKey(enviroment,
+ connectionFactory, destinationType, username, password,
+ transacted);
+ XaJmsConnectionPool pool = new XaJmsConnectionPool(poolKey);
+
+ transactions.put(transaction, pool);
+
+ TransactionStrategy tx = TransactionStrategy
+ .getTransactionStrategy(true);
+
+ try
+ {
+ tx.registerSynchronization(new PoolSynchronization(
+ transactions, pool));
+ }
+ catch (TransactionStrategyException ex)
+ {
+ logger.warn("Problem when enlisting synchronization", ex);
+
+ throw new ConnectionException(ex);
+ }
+
+ return pool;
+ }
+ else
+ return connection;
+ }
+ }
+
+}
+
+class PoolSynchronization implements Synchronization
+{
+ PoolSynchronization(HashMap<Object, JmsConnectionPool> transactions,
+ XaJmsConnectionPool pool)
+ {
+ _transactions = transactions;
+ _pool = pool;
+ }
+
+ public void beforeCompletion ()
+ {
+ }
+
+ public void afterCompletion (int status) // we don't care about the
+ // status
+ {
+ _pool.removeSessionPool();
+ _pool.terminated();
+
+ synchronized (_transactions)
+ {
+ _transactions.remove(_pool);
+ }
+ }
+
+ private HashMap<Object, JmsConnectionPool> _transactions;
+
+ private XaJmsConnectionPool _pool;
+}
Modified: labs/jbossesb/branches/JBESB_4_2_1_GA_CP/product/rosetta/src/org/jboss/soa/esb/common/JBossESBPropertyService.java
===================================================================
--- labs/jbossesb/branches/JBESB_4_2_1_GA_CP/product/rosetta/src/org/jboss/soa/esb/common/JBossESBPropertyService.java 2008-02-01 06:15:14 UTC (rev 18236)
+++ labs/jbossesb/branches/JBESB_4_2_1_GA_CP/product/rosetta/src/org/jboss/soa/esb/common/JBossESBPropertyService.java 2008-02-01 06:32:55 UTC (rev 18237)
@@ -27,6 +27,7 @@
import java.net.URL;
import javax.transaction.Status;
+import javax.transaction.Synchronization;
import javax.transaction.Transaction;
import javax.transaction.TransactionManager;
@@ -262,6 +263,22 @@
}
/**
+ * Add a synchronization to the current transaction.
+ * @param sync
+ * @throws TransactionStrategyException
+ */
+ public void registerSynchronization (Synchronization sync) throws TransactionStrategyException
+ {
+ try
+ {
+ tm.getTransaction().registerSynchronization(sync);
+ }
+ catch (final Throwable th)
+ {
+ throw new TransactionStrategyException("Problem when registering synchronization: ", th);
+ }
+ }
+ /**
* Is the currently associated transaction active?
* @return
* @throws TransactionStrategyException
Modified: labs/jbossesb/branches/JBESB_4_2_1_GA_CP/product/rosetta/src/org/jboss/soa/esb/common/TransactionStrategy.java
===================================================================
--- labs/jbossesb/branches/JBESB_4_2_1_GA_CP/product/rosetta/src/org/jboss/soa/esb/common/TransactionStrategy.java 2008-02-01 06:15:14 UTC (rev 18236)
+++ labs/jbossesb/branches/JBESB_4_2_1_GA_CP/product/rosetta/src/org/jboss/soa/esb/common/TransactionStrategy.java 2008-02-01 06:32:55 UTC (rev 18237)
@@ -22,6 +22,8 @@
package org.jboss.soa.esb.common;
+import javax.transaction.Synchronization;
+
/**
* This class represents the transaction strategy that is currently in force
* within the ESB. At present there are two strategies employed, a null strategy
@@ -119,6 +121,13 @@
*/
public abstract void resume (Object tx) throws TransactionStrategyException;
+ /**
+ * Add a synchronization to the current transaction.
+ * @param sync
+ * @throws TransactionStrategyException
+ */
+ public abstract void registerSynchronization (Synchronization sync) throws TransactionStrategyException;
+
public static void setStrategy (TransactionStrategy txSt)
{
_currentStrategy.set(txSt);
@@ -202,6 +211,15 @@
}
/**
+ * Add a synchronization to the current transaction.
+ * @param sync
+ * @throws TransactionStrategyException
+ */
+ public void registerSynchronization (Synchronization sync) throws TransactionStrategyException
+ {
+ }
+
+ /**
* Is the currently associated transaction active?
* @return
* @throws TransactionStrategyException
Modified: labs/jbossesb/branches/JBESB_4_2_1_GA_CP/product/skip.properties-example
===================================================================
--- labs/jbossesb/branches/JBESB_4_2_1_GA_CP/product/skip.properties-example 2008-02-01 06:15:14 UTC (rev 18236)
+++ labs/jbossesb/branches/JBESB_4_2_1_GA_CP/product/skip.properties-example 2008-02-01 06:32:55 UTC (rev 18237)
@@ -1,7 +1,8 @@
#
# The following properties should be added or removed if you want to skip those
-# parts of the build. Adding all of these skips cuts "ant clean dist" on my
-# machine down from about 3m30s to about 1m10s. Without the clean it's about 55s
+# parts of the build. Adding all of these skips cuts "ant clean dist" on a sample
+# machine down from about 3m30s to about 1m10s. Without the clean it's about 55s.
+# Without the tests it is even less.
#
#
@@ -13,3 +14,4 @@
#skip.server.esb=true
#skip.docs=true
#skip.samples=true
+#skip.tests=true
\ No newline at end of file
More information about the jboss-svn-commits
mailing list