activemq-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From gtu...@apache.org
Subject svn commit: r733811 - /activemq/trunk/activemq-core/src/main/java/org/apache/activemq/ActiveMQConnectionFactory.java
Date Mon, 12 Jan 2009 15:48:14 GMT
Author: gtully
Date: Mon Jan 12 07:48:07 2009
New Revision: 733811

URL: http://svn.apache.org/viewvc?rev=733811&view=rev
Log:
resolve AMQ-2062 - add setExceptionListener to amq connection factory - 

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=733811&r1=733810&r2=733811&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
Mon Jan 12 07:48:07 2009
@@ -27,6 +27,7 @@
 
 import javax.jms.Connection;
 import javax.jms.ConnectionFactory;
+import javax.jms.ExceptionListener;
 import javax.jms.JMSException;
 import javax.jms.QueueConnection;
 import javax.jms.QueueConnectionFactory;
@@ -110,6 +111,7 @@
     private int sendTimeout =0;
     private boolean sendAcksAsync=true;
     private TransportListener transportListener;
+	private ExceptionListener exceptionListener;
 
     // /////////////////////////////////////////////
     //
@@ -286,7 +288,7 @@
         return connection;
     }
 
-    protected void configureConnection(ActiveMQConnection connection) {
+    protected void configureConnection(ActiveMQConnection connection) throws JMSException
{
         connection.setPrefetchPolicy(getPrefetchPolicy());
         connection.setDisableTimeStampsByDefault(isDisableTimeStampsByDefault());
         connection.setOptimizedMessageDispatch(isOptimizedMessageDispatch());
@@ -311,6 +313,9 @@
         if (transportListener != null) {
             connection.addTransportListener(transportListener);
         }
+        if (exceptionListener != null) {
+        	connection.setExceptionListener(exceptionListener);
+        }
     }
 
     // /////////////////////////////////////////////
@@ -859,4 +864,22 @@
     public void setTransportListener(TransportListener transportListener) {
         this.transportListener = transportListener;
     }
+    
+    
+    public ExceptionListener getExceptionListener() {
+        return exceptionListener;
+    }
+    
+    /**
+     * Allows an {@link ExceptionListener} to be configured on the ConnectionFactory so that
when this factory
+     * is used by frameworks which don't expose the Connection such as Spring JmsTemplate,
you can register
+     * an exception listener.
+     * <p> Note: access to this exceptionLinstener will <b>not</b> be serialized
if it is associated with more than
+     * on connection (as it will be if more than one connection is subsequently created by
this connection factory)
+     * @param exceptionListener sets the exception listener to be registered on all connections
+     * created by this factory
+     */
+    public void setExceptionListener(ExceptionListener exceptionListener) {
+    	this.exceptionListener = exceptionListener;
+    }
 }



Mime
View raw message