Author: dlr
Date: Mon Apr  9 12:04:43 2007
New Revision: 526876

URL: http://svn.apache.org/viewvc?view=rev&rev=526876
Log:
* src/java/org/apache/xmlrpc/WebServer.java
  (Runner.run): Improve JavaDoc.  Add and improve inline comments.
   Change check against the inactive count of Runners in the thread
   pool to be a percentage (20%) of the total handler thread count
   (used to deteremine whether to re-pool a Runner after completion of
   its work).

Modified:
    
webservices/xmlrpc/branches/XMLRPC_1_2_BRANCH/src/java/org/apache/xmlrpc/WebServer.java

Modified: 
webservices/xmlrpc/branches/XMLRPC_1_2_BRANCH/src/java/org/apache/xmlrpc/WebServer.java
URL: 
http://svn.apache.org/viewvc/webservices/xmlrpc/branches/XMLRPC_1_2_BRANCH/src/java/org/apache/xmlrpc/WebServer.java?view=diff&rev=526876&r1=526875&r2=526876
==============================================================================
--- 
webservices/xmlrpc/branches/XMLRPC_1_2_BRANCH/src/java/org/apache/xmlrpc/WebServer.java
 (original)
+++ 
webservices/xmlrpc/branches/XMLRPC_1_2_BRANCH/src/java/org/apache/xmlrpc/WebServer.java
 Mon Apr  9 12:04:43 2007
@@ -672,20 +672,26 @@
         }
 
         /**
-         * Delegates to <code>con.run()</code>.
+         * Handle requests from incoming connections by delegating to
+         * <code>con.run()</code>.  Perform cleanup, either by
+         * finishing, or by re-pooling this instance.
          */
         public void run()
         {
             while (con != null && Thread.currentThread() == thread)
             {
+                // Handle the request.
                 con.run();
                 count++;
                 con = null;
 
-                if (count > 200 || threadpool.size() > 20)
+                // Cleanup, either by completing our run, or
+                // re-pooling ourself.
+                if (count > 200 ||
+                    threadpool.size() > 0.20 * XmlRpc.getMaxThreads())
                 {
-                    // We're old, or the number of threads in the pool
-                    // is large.
+                    // We're an old thread, or we already have a sufficient
+                    // number of inactive Runner threads in the pool.
                     return;
                 }
                 synchronized(this)


Reply via email to