[jboss-svn-commits] JBL Code SVN: r22454 - labs/jbossesb/workspace/skeagh/runtime/src/main/java/org/jboss/esb/jms.

jboss-svn-commits at lists.jboss.org jboss-svn-commits at lists.jboss.org
Fri Sep 5 12:24:13 EDT 2008


Author: tfennelly
Date: 2008-09-05 12:24:12 -0400 (Fri, 05 Sep 2008)
New Revision: 22454

Modified:
   labs/jbossesb/workspace/skeagh/runtime/src/main/java/org/jboss/esb/jms/AbstractMessageListener.java
Log:
more tweaks

Modified: labs/jbossesb/workspace/skeagh/runtime/src/main/java/org/jboss/esb/jms/AbstractMessageListener.java
===================================================================
--- labs/jbossesb/workspace/skeagh/runtime/src/main/java/org/jboss/esb/jms/AbstractMessageListener.java	2008-09-05 16:18:48 UTC (rev 22453)
+++ labs/jbossesb/workspace/skeagh/runtime/src/main/java/org/jboss/esb/jms/AbstractMessageListener.java	2008-09-05 16:24:12 UTC (rev 22454)
@@ -65,6 +65,10 @@
      * JMS Destination.
      */
     private Destination destination = null;
+    /**
+     * JMS Exception listener.
+     */
+    private ExceptionListener exceptionListener;
 
     /**
      * Public constructor.
@@ -184,15 +188,22 @@
             // Listen for exceptions on the connection...
             try
             {
-                conn.setExceptionListener(new ExceptionListener());
+                if (exceptionListener != null)
+                {
+                    conn.setExceptionListener(exceptionListener);
+                } else
+                {
+                    conn.setExceptionListener(new DefaultExceptionListener());
+                }
             } catch (JMSException e)
             {
-                throw new DeploymentException("Failed to attach an ExceptionListener.", e);
+                throw new DeploymentException("Failed to attach an DefaultExceptionListener.", e);
             }
             logger.debug("Successfully connected listener '" + getClass().getName() + "' to JMS destination '" + destinationName + "'.");
-        } finally {
+        } finally
+        {
             // If we failed to create the message consumer, close and clean up....
-            if(messageConsumer == null)
+            if (messageConsumer == null)
             {
                 close();
             }
@@ -200,6 +211,26 @@
     }
 
     /**
+     * Get the exception listener.
+     *
+     * @return The exception listener.
+     */
+    public final ExceptionListener getExceptionListener()
+    {
+        return exceptionListener;
+    }
+
+    /**
+     * Set the exception listener.
+     *
+     * @param exceptionListener The exception listener.
+     */
+    public final void setExceptionListener(final ExceptionListener exceptionListener)
+    {
+        this.exceptionListener = exceptionListener;
+    }
+
+    /**
      * Get the JMS Connection factory.
      *
      * @return Connection Factory.
@@ -328,7 +359,7 @@
      *
      * @author <a href="mailto:tom.fennelly at jboss.com">tom.fennelly at jboss.com</a>
      */
-    private class ExceptionListener implements javax.jms.ExceptionListener
+    private class DefaultExceptionListener implements ExceptionListener
     {
 
         /**
@@ -345,7 +376,7 @@
          */
         public final void onException(final JMSException e)
         {
-            synchronized (ExceptionListener.class)
+            synchronized (DefaultExceptionListener.class)
             {
                 if (!hasHandledOneException)
                 {




More information about the jboss-svn-commits mailing list