[jboss-cvs] JBossAS SVN: r72162 - branches/Branch_4_2/connector/src/main/org/jboss/resource/adapter/jms/inflow.

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Mon Apr 14 07:00:59 EDT 2008


Author: adrian at jboss.org
Date: 2008-04-14 07:00:59 -0400 (Mon, 14 Apr 2008)
New Revision: 72162

Modified:
   branches/Branch_4_2/connector/src/main/org/jboss/resource/adapter/jms/inflow/JmsServerSessionPool.java
Log:
[JBAS-5428] - Fix the session pool shutdown

Modified: branches/Branch_4_2/connector/src/main/org/jboss/resource/adapter/jms/inflow/JmsServerSessionPool.java
===================================================================
--- branches/Branch_4_2/connector/src/main/org/jboss/resource/adapter/jms/inflow/JmsServerSessionPool.java	2008-04-14 10:40:31 UTC (rev 72161)
+++ branches/Branch_4_2/connector/src/main/org/jboss/resource/adapter/jms/inflow/JmsServerSessionPool.java	2008-04-14 11:00:59 UTC (rev 72162)
@@ -21,8 +21,6 @@
  */
 package org.jboss.resource.adapter.jms.inflow;
 
-import java.security.AccessController;
-import java.security.PrivilegedAction;
 import java.util.ArrayList;
 
 import javax.jms.Connection;
@@ -140,7 +138,6 @@
       }
       catch (Throwable t)
       {
-         log.error("Unable to get a server session", t);
          throw new JMSException("Unable to get a server session " + t);
       }
       
@@ -179,7 +176,7 @@
    {
       JmsActivationSpec spec = activation.getActivationSpec();
       ArrayList clonedSessions = null;
-
+      
       // Create the sessions
       synchronized (serverSessions)
       {
@@ -217,9 +214,9 @@
          {
             JmsServerSession session = (JmsServerSession) serverSessions.get(i);
             session.teardown();
+            --sessionCount;
          }
 
-         sessionCount -= serverSessions.size();
          serverSessions.clear();
 
          if (activation.getActivationSpec().isForceClearOnShutdown())
@@ -228,19 +225,23 @@
             int forceClearAttempts = activation.getActivationSpec().getForceClearAttempts();
             long forceClearInterval = activation.getActivationSpec().getForceClearOnShutdownInterval();
             
-            log.info("Force clear behavior in effect. Waiting for " + forceClearInterval + " milliseconds for " + forceClearAttempts + " attempts.");
+            log.trace(this + " force clear behavior in effect. Waiting for " + forceClearInterval + " milliseconds for " + forceClearAttempts + " attempts.");
            
             while((sessionCount > 0) && (attempts < forceClearAttempts))
             {
                try
                {
+                  int currentSessions = sessionCount;
                   serverSessions.wait(forceClearInterval);
-                  log.trace("Clear attempt " + attempts); 
-                  ++attempts;               
-            
-               }catch(InterruptedException ignore)
+                  // Number of session didn't change
+                  if (sessionCount == currentSessions)
+                  {
+                     ++attempts;
+                     log.trace(this + " clear attempt failed " + attempts); 
+                  }
+               }
+               catch(InterruptedException ignore)
                {
-                  
                }
             
             }
@@ -309,4 +310,4 @@
       }
    }
 
-}
\ No newline at end of file
+}




More information about the jboss-cvs-commits mailing list