[jboss-cvs] JBossAS SVN: r60314 - branches/Branch_4_0/server/src/main/org/jboss/invocation/pooled/interfaces.

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Mon Feb 5 17:32:19 EST 2007


Author: scottmarlownovell
Date: 2007-02-05 17:32:19 -0500 (Mon, 05 Feb 2007)
New Revision: 60314

Modified:
   branches/Branch_4_0/server/src/main/org/jboss/invocation/pooled/interfaces/PooledInvokerProxy.java
Log:
JBAS-4047 Do not hold synchronization lock while testing connection.


Modified: branches/Branch_4_0/server/src/main/org/jboss/invocation/pooled/interfaces/PooledInvokerProxy.java
===================================================================
--- branches/Branch_4_0/server/src/main/org/jboss/invocation/pooled/interfaces/PooledInvokerProxy.java	2007-02-05 22:28:52 UTC (rev 60313)
+++ branches/Branch_4_0/server/src/main/org/jboss/invocation/pooled/interfaces/PooledInvokerProxy.java	2007-02-05 22:32:19 UTC (rev 60314)
@@ -493,17 +493,23 @@
       return cs;
    }
 
-   protected synchronized ClientSocket getPooledConnection()
+   protected ClientSocket firstConnection()
    {
+       synchronized (pool)
+       {
+           if(pool.size() > 0)
+            return (ClientSocket)pool.removeFirst();
+       }
+       return null;
+   }
+
+   protected ClientSocket getPooledConnection()
+   {
       ClientSocket socket = null;
-      while (pool.size() > 0)
+      while ((socket = firstConnection()) != null)
       {
          try
          {
-            synchronized( pool )
-            {
-               socket = (ClientSocket)pool.removeFirst();
-            }
             // Test to see if socket is alive by send ACK message
             if( trace )
                log.trace("Checking pooled socket: "+socket+", address: "+socket.socket.getLocalSocketAddress());
@@ -553,7 +559,7 @@
     * @return true if socket was added to the pool, false if the pool
     *    was full
     */
-   protected synchronized boolean returnConnection(ClientSocket socket)
+   protected boolean returnConnection(ClientSocket socket)
    {
       boolean pooled = false;
       synchronized( pool )




More information about the jboss-cvs-commits mailing list