[jboss-cvs] JBossAS SVN: r111343 - in projects/jboss-jca/trunk: rhq/src/test/java/org/jboss/jca/rhq/test and 1 other directory.

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Wed May 11 11:04:46 EDT 2011


Author: jesper.pedersen
Date: 2011-05-11 11:04:46 -0400 (Wed, 11 May 2011)
New Revision: 111343

Modified:
   projects/jboss-jca/trunk/core/src/main/java/org/jboss/jca/core/connectionmanager/pool/mcp/SemaphoreArrayListManagedConnectionPool.java
   projects/jboss-jca/trunk/rhq/src/test/java/org/jboss/jca/rhq/test/DsTestCase.java
Log:
Fix pool.flush(true)

Modified: projects/jboss-jca/trunk/core/src/main/java/org/jboss/jca/core/connectionmanager/pool/mcp/SemaphoreArrayListManagedConnectionPool.java
===================================================================
--- projects/jboss-jca/trunk/core/src/main/java/org/jboss/jca/core/connectionmanager/pool/mcp/SemaphoreArrayListManagedConnectionPool.java	2011-05-11 14:48:27 UTC (rev 111342)
+++ projects/jboss-jca/trunk/core/src/main/java/org/jboss/jca/core/connectionmanager/pool/mcp/SemaphoreArrayListManagedConnectionPool.java	2011-05-11 15:04:46 UTC (rev 111343)
@@ -34,7 +34,6 @@
 
 import java.util.ArrayList;
 import java.util.Collections;
-import java.util.HashSet;
 import java.util.Iterator;
 import java.util.Set;
 import java.util.concurrent.ConcurrentHashMap;
@@ -106,7 +105,7 @@
       new ConcurrentHashMap<ConnectionListener, ConnectionListener>();
 
    /** The checked out connections */
-   private HashSet<ConnectionListener> checkedOut = new HashSet<ConnectionListener>();
+   private ArrayList<ConnectionListener> checkedOut = new ArrayList<ConnectionListener>();
 
    /** Whether the pool has been shutdown */
    private AtomicBoolean shutdown = new AtomicBoolean(false);
@@ -477,16 +476,19 @@
                log.trace("Flushing pool checkedOut=" + checkedOut + " inPool=" + cls);
 
             // Mark checked out connections as requiring destruction
-            for (Iterator<ConnectionListener> i = checkedOut.iterator(); i.hasNext();)
+            while (checkedOut.size() > 0)
             {
-               ConnectionListener cl = i.next();
+               ConnectionListener cl = checkedOut.remove(0);
 
                if (trace)
                   log.trace("Flush marking checked out connection for destruction " + cl);
 
                cl.setState(ConnectionState.DESTROY);
 
-               // We could mark them for eager kill too... 
+               if (destroy == null)
+                  destroy = new ArrayList<ConnectionListener>(1);
+
+               destroy.add(cl);
             }
          }
 
@@ -505,10 +507,8 @@
       // We need to destroy some connections
       if (destroy != null)
       {
-         for (int i = 0; i < destroy.size(); ++i)
+         for (ConnectionListener cl : destroy)
          {
-            ConnectionListener cl = destroy.get(i);
-
             if (trace)
                log.trace("Destroying flushed connection " + cl);
 

Modified: projects/jboss-jca/trunk/rhq/src/test/java/org/jboss/jca/rhq/test/DsTestCase.java
===================================================================
--- projects/jboss-jca/trunk/rhq/src/test/java/org/jboss/jca/rhq/test/DsTestCase.java	2011-05-11 14:48:27 UTC (rev 111342)
+++ projects/jboss-jca/trunk/rhq/src/test/java/org/jboss/jca/rhq/test/DsTestCase.java	2011-05-11 15:04:46 UTC (rev 111343)
@@ -270,7 +270,6 @@
     * 
     * @throws Throwable exception
     */
-   @Ignore
    @Test
    public void testDsPoolFlushKill() throws Throwable
    {



More information about the jboss-cvs-commits mailing list