[jboss-svn-commits] JBL Code SVN: r27570 - labs/jbossesb/trunk/product/rosetta/src/org/jboss/internal/soa/esb/rosetta/pooling.

jboss-svn-commits at lists.jboss.org jboss-svn-commits at lists.jboss.org
Sun Jul 5 07:08:45 EDT 2009


Author: kevin.conner at jboss.com
Date: 2009-07-05 07:08:45 -0400 (Sun, 05 Jul 2009)
New Revision: 27570

Modified:
   labs/jbossesb/trunk/product/rosetta/src/org/jboss/internal/soa/esb/rosetta/pooling/JmsConnectionPool.java
Log:
Clean pool on specific errors: JBESB-2678

Modified: labs/jbossesb/trunk/product/rosetta/src/org/jboss/internal/soa/esb/rosetta/pooling/JmsConnectionPool.java
===================================================================
--- labs/jbossesb/trunk/product/rosetta/src/org/jboss/internal/soa/esb/rosetta/pooling/JmsConnectionPool.java	2009-07-05 10:57:05 UTC (rev 27569)
+++ labs/jbossesb/trunk/product/rosetta/src/org/jboss/internal/soa/esb/rosetta/pooling/JmsConnectionPool.java	2009-07-05 11:08:45 UTC (rev 27570)
@@ -196,14 +196,8 @@
              * We check for IllegalStateException as this appears to be the indicator
              * exception used by JBoss Messaging when the connection has disappeared.
              */
-            Throwable cause = jmse ;
-            while(cause.getCause() != null)
+            if (messagingConnectionFailure(jmse))
             {
-                cause = cause.getCause() ;
-            }
-            if (cause instanceof IllegalStateException)
-            {
-                removeSessionPool() ;
                 return internalGetSession(acknowledgeMode) ;
             }
             throw jmse ;
@@ -243,11 +237,18 @@
             // free session.  Will JmsSessionPool.getSession will add a session
             // to a pool that is not "full"...
             for (JmsSessionPool sessionPool : sessionPools) {
-                JmsSession session = sessionPool.getSession(mode, transacted);
-
-                if(session != null) {
-                    return session;
-                }   
+                try {
+                    JmsSession session = sessionPool.getSession(mode, transacted);
+    
+                    if(session != null) {
+                        return session;
+                    }   
+                } catch (final JMSException jmse) {
+                    if (messagingConnectionFailure(jmse)) {
+                        sessionPool.cleanSessionPool() ;
+                    }
+                    throw jmse ;
+                }
             }
 
             // OK... all the existing session pools are full and have no free sessions.  If we can add
@@ -404,6 +405,27 @@
     }
     
     /**
+     * Check the exception to see whether it indicates a connection failure in JBM
+     * @param jmse The current JMS Exception
+     * @return true if it suggests a failure, false otherwise.
+     */
+    private boolean messagingConnectionFailure(final JMSException jmse)
+    {
+        /*
+         * JBoss Messaging can drop the connection from the server side
+         * without calling back on the exception listener.  We check for
+         * IllegalStateException as this appears to be the indicator
+         * exception used by JBoss Messaging when the connection has disappeared.
+         */
+        Throwable cause = jmse ;
+        while(cause.getCause() != null)
+        {
+            cause = cause.getCause() ;
+        }
+        return (cause instanceof IllegalStateException) ;
+    }
+    
+    /**
      * Release a session from the in use mapping.
      * @param session The session to release.
      */




More information about the jboss-svn-commits mailing list