activemq-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jstrac...@apache.org
Subject svn commit: r579498 - /activemq/trunk/activemq-core/src/main/java/org/apache/activemq/ActiveMQConnectionFactory.java
Date Wed, 26 Sep 2007 08:08:15 GMT
Author: jstrachan
Date: Wed Sep 26 01:08:14 2007
New Revision: 579498

URL: http://svn.apache.org/viewvc?rev=579498&view=rev
Log:
added patch for AMQ-1434 to allow transport listeners to be used with a connection factory
for easy integration with Spring JmsTemplate etc

Modified:
    activemq/trunk/activemq-core/src/main/java/org/apache/activemq/ActiveMQConnectionFactory.java

Modified: activemq/trunk/activemq-core/src/main/java/org/apache/activemq/ActiveMQConnectionFactory.java
URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/ActiveMQConnectionFactory.java?rev=579498&r1=579497&r2=579498&view=diff
==============================================================================
--- activemq/trunk/activemq-core/src/main/java/org/apache/activemq/ActiveMQConnectionFactory.java
(original)
+++ activemq/trunk/activemq-core/src/main/java/org/apache/activemq/ActiveMQConnectionFactory.java
Wed Sep 26 01:08:14 2007
@@ -41,6 +41,7 @@
 import org.apache.activemq.management.StatsImpl;
 import org.apache.activemq.transport.Transport;
 import org.apache.activemq.transport.TransportFactory;
+import org.apache.activemq.transport.TransportListener;
 import org.apache.activemq.util.IdGenerator;
 import org.apache.activemq.util.IntrospectionSupport;
 import org.apache.activemq.util.JMSExceptionSupport;
@@ -104,6 +105,7 @@
     private boolean watchTopicAdvisories = true;
     private int producerWindowSize = DEFAULT_PRODUCER_WINDOW_SIZE;
     private long warnAboutUnstartedConnectionTimeout = 500L;
+    private TransportListener transportListener;
 
     // /////////////////////////////////////////////
     //
@@ -299,6 +301,9 @@
         connection.setWatchTopicAdvisories(isWatchTopicAdvisories());
         connection.setProducerWindowSize(getProducerWindowSize());
         connection.setWarnAboutUnstartedConnectionTimeout(getWarnAboutUnstartedConnectionTimeout());
+        if (transportListener != null) {
+            connection.addTransportListener(transportListener);
+        }
     }
 
     // /////////////////////////////////////////////
@@ -799,5 +804,21 @@
      */
     public void setWarnAboutUnstartedConnectionTimeout(long warnAboutUnstartedConnectionTimeout)
{
         this.warnAboutUnstartedConnectionTimeout = warnAboutUnstartedConnectionTimeout;
+    }
+
+    public TransportListener getTransportListener() {
+        return transportListener;
+    }
+
+    /**
+     * Allows a listener to be configured on the ConnectionFactory so that when this factory
is used
+     * with frameworks which don't expose the Connection such as Spring JmsTemplate, you
can still register
+     * a transport listener.
+     *
+     * @param transportListener sets the listener to be registered on all connections
+     * created by this factory
+     */
+    public void setTransportListener(TransportListener transportListener) {
+        this.transportListener = transportListener;
     }
 }



Mime
View raw message