[jboss-jira] [JBoss JIRA] Created: (JBAS-4047) PooledInvokerProxy.getPooledConnection() could hold a lock for shorter period of time

Scott Marlow (JIRA) jira-events at jboss.com
Thu Feb 1 14:09:19 EST 2007


PooledInvokerProxy.getPooledConnection() could hold a lock for shorter period of time
-------------------------------------------------------------------------------------

                 Key: JBAS-4047
                 URL: http://jira.jboss.com/jira/browse/JBAS-4047
             Project: JBoss Application Server
          Issue Type: Feature Request
      Security Level: Public (Everyone can see)
          Components: Remoting
    Affects Versions: JBossAS-5.0.0.Beta1, JBossAS-4.0.5.GA
            Reporter: Scott Marlow
         Assigned To: Scott Marlow
            Priority: Optional


I'm seeing Java lock object contention in the org.jboss.invocation.pooled.interfaces.PooledInvokerProxy.getPooledConnection().  I would like to reduce the time that we hold the lock to boost performance.

for the current 4.0 head implementation, I'm thinking about something like this:

svn diff server\src\main\org\jboss\invocation\pooled\interfaces\PooledInvokerProxy.java
Index: server/src/main/org/jboss/invocation/pooled/interfaces/PooledInvokerProxy.java
===================================================================
--- server/src/main/org/jboss/invocation/pooled/interfaces/PooledInvokerProxy.java      (revision 60160)
+++ server/src/main/org/jboss/invocation/pooled/interfaces/PooledInvokerProxy.java      (working copy)
@@ -493,17 +493,23 @@
       return cs;
    }

+   protected ClientSocket firstConnection()
+   {
+       synchronized (pool)
+       {
+           if(pool.size() > 0)
+            return (ClientSocket)pool.removeFirst();
+       }
+       return null;
+   }
+
    protected synchronized 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());



-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://jira.jboss.com/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        



More information about the jboss-jira mailing list