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

jboss-svn-commits at lists.jboss.org jboss-svn-commits at lists.jboss.org
Wed Jun 10 07:15:34 EDT 2009


Author: kevin.conner at jboss.com
Date: 2009-06-10 07:15:33 -0400 (Wed, 10 Jun 2009)
New Revision: 26897

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

Modified: labs/jbossesb/branches/JBESB_4_4_GA_CP/product/rosetta/src/org/jboss/internal/soa/esb/rosetta/pooling/JmsConnectionPool.java
===================================================================
--- labs/jbossesb/branches/JBESB_4_4_GA_CP/product/rosetta/src/org/jboss/internal/soa/esb/rosetta/pooling/JmsConnectionPool.java	2009-06-10 08:04:35 UTC (rev 26896)
+++ labs/jbossesb/branches/JBESB_4_4_GA_CP/product/rosetta/src/org/jboss/internal/soa/esb/rosetta/pooling/JmsConnectionPool.java	2009-06-10 11:15:33 UTC (rev 26897)
@@ -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