You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@servicemix.apache.org by ge...@apache.org on 2007/11/19 11:20:18 UTC

svn commit: r596252 - in /servicemix/branches/servicemix-3.2: core/servicemix-core/src/main/java/org/apache/servicemix/jbi/nmr/flow/jms/ distributions/apache-servicemix/src/main/release/conf/

Author: gertv
Date: Mon Nov 19 02:20:15 2007
New Revision: 596252

URL: http://svn.apache.org/viewvc?rev=596252&view=rev
Log:
SM-1132: Closing the JMS connection pools

Modified:
    servicemix/branches/servicemix-3.2/core/servicemix-core/src/main/java/org/apache/servicemix/jbi/nmr/flow/jms/JMSFlow.java
    servicemix/branches/servicemix-3.2/distributions/apache-servicemix/src/main/release/conf/activemq.xml
    servicemix/branches/servicemix-3.2/distributions/apache-servicemix/src/main/release/conf/jndi.xml

Modified: servicemix/branches/servicemix-3.2/core/servicemix-core/src/main/java/org/apache/servicemix/jbi/nmr/flow/jms/JMSFlow.java
URL: http://svn.apache.org/viewvc/servicemix/branches/servicemix-3.2/core/servicemix-core/src/main/java/org/apache/servicemix/jbi/nmr/flow/jms/JMSFlow.java?rev=596252&r1=596251&r2=596252&view=diff
==============================================================================
--- servicemix/branches/servicemix-3.2/core/servicemix-core/src/main/java/org/apache/servicemix/jbi/nmr/flow/jms/JMSFlow.java (original)
+++ servicemix/branches/servicemix-3.2/core/servicemix-core/src/main/java/org/apache/servicemix/jbi/nmr/flow/jms/JMSFlow.java Mon Nov 19 02:20:15 2007
@@ -16,6 +16,7 @@
  */
 package org.apache.servicemix.jbi.nmr.flow.jms;
 
+import javax.jbi.JBIException;
 import javax.jms.ConnectionFactory;
 import javax.jms.JMSException;
 import javax.jms.Message;
@@ -40,8 +41,11 @@
  */
 public class JMSFlow extends AbstractJMSFlow {
 
+    private PooledConnectionFactory factory;
+
     protected ConnectionFactory createConnectionFactoryFromUrl(String jmsURL) {
-        return (jmsURL != null) ? new PooledConnectionFactory(jmsURL) : new PooledConnectionFactory();
+        factory = (jmsURL != null) ? new PooledConnectionFactory(jmsURL) : new PooledConnectionFactory();
+        return factory;
     }
 
     /**
@@ -74,4 +78,15 @@
         });
     }
 
+    @Override
+    public void shutDown() throws JBIException {
+        super.shutDown();
+        if (factory != null) {
+            try {
+                factory.stop();
+            } catch (Exception e) {
+                log.warn("Unable to stop JMS connection pool: " + e, e);
+            }
+        }
+    }
 }

Modified: servicemix/branches/servicemix-3.2/distributions/apache-servicemix/src/main/release/conf/activemq.xml
URL: http://svn.apache.org/viewvc/servicemix/branches/servicemix-3.2/distributions/apache-servicemix/src/main/release/conf/activemq.xml?rev=596252&r1=596251&r2=596252&view=diff
==============================================================================
--- servicemix/branches/servicemix-3.2/distributions/apache-servicemix/src/main/release/conf/activemq.xml (original)
+++ servicemix/branches/servicemix-3.2/distributions/apache-servicemix/src/main/release/conf/activemq.xml Mon Nov 19 02:20:15 2007
@@ -20,7 +20,7 @@
 <beans xmlns:amq="http://activemq.org/config/1.0">
   
   <!-- ActiveMQ JMS Broker configuration -->
-  <amq:broker depends-on="jmxServer" useShutdownHook="false">
+  <amq:broker id="broker" depends-on="jmxServer" useShutdownHook="false">
 
     <!-- Disable creation of the jmx connector 
          which is created in the jmx.xml configuration file -->

Modified: servicemix/branches/servicemix-3.2/distributions/apache-servicemix/src/main/release/conf/jndi.xml
URL: http://svn.apache.org/viewvc/servicemix/branches/servicemix-3.2/distributions/apache-servicemix/src/main/release/conf/jndi.xml?rev=596252&r1=596251&r2=596252&view=diff
==============================================================================
--- servicemix/branches/servicemix-3.2/distributions/apache-servicemix/src/main/release/conf/jndi.xml (original)
+++ servicemix/branches/servicemix-3.2/distributions/apache-servicemix/src/main/release/conf/jndi.xml Mon Nov 19 02:20:15 2007
@@ -24,7 +24,7 @@
        xmlns:amqra="http://activemq.org/ra/1.0"
        xmlns:util="http://www.springframework.org/schema/util">
 
-  <bean id="jndi" 
+  <bean id="jndi" depends-on="broker"
         class="org.apache.xbean.spring.jndi.SpringInitialContextFactory" 
         factory-method="makeInitialContext"
         singleton="true">