[jboss-svn-commits] JBL Code SVN: r25734 - 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
Thu Mar 19 11:10:29 EDT 2009


Author: kevin.conner at jboss.com
Date: 2009-03-19 11:10:29 -0400 (Thu, 19 Mar 2009)
New Revision: 25734

Modified:
   labs/jbossesb/branches/JBESB_4_4_GA_CP/product/rosetta/src/org/jboss/internal/soa/esb/rosetta/pooling/JmsConnectionPool.java
Log:
Cleanup and retry session creation on connection error: JBESB-2481

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-03-19 15:10:16 UTC (rev 25733)
+++ labs/jbossesb/branches/JBESB_4_4_GA_CP/product/rosetta/src/org/jboss/internal/soa/esb/rosetta/pooling/JmsConnectionPool.java	2009-03-19 15:10:29 UTC (rev 25734)
@@ -210,6 +210,34 @@
      */
     public synchronized JmsSession getSession(final int acknowledgeMode) throws NamingException, JMSException, ConnectionException
     {
+        try
+        {
+            return internalGetSession(acknowledgeMode) ;
+        }
+        catch (final JMSException jmse)
+        {
+            /*
+             * JBoss Messaging may drop the connection from the server side.
+             * 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() ;
+            }
+            if (cause instanceof IllegalStateException)
+            {
+                removeSessionPool() ;
+                return internalGetSession(acknowledgeMode) ;
+            }
+            throw jmse ;
+        }
+    }
+    
+    private synchronized JmsSession internalGetSession(final int acknowledgeMode)
+        throws NamingException, JMSException, ConnectionException
+    {
         try {
             initConnection() ;
         } catch (final NamingContextException nce) {




More information about the jboss-svn-commits mailing list