james-server-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From n...@apache.org
Subject svn commit: r471243 - /james/server/trunk/src/java/org/apache/james/util/connection/ServerConnection.java
Date Sat, 04 Nov 2006 18:28:54 GMT
Author: noel
Date: Sat Nov  4 10:28:53 2006
New Revision: 471243

URL: http://svn.apache.org/viewvc?view=rev&rev=471243
Log:
JAMES-671.  Don't accept() unless we're prepared to process the connection.  This change is
perhaps excessively conservative.  We can probably eliminate the loop and the timeout value
for wait (which is just a backstop), and just rely upon notification.

Modified:
    james/server/trunk/src/java/org/apache/james/util/connection/ServerConnection.java

Modified: james/server/trunk/src/java/org/apache/james/util/connection/ServerConnection.java
URL: http://svn.apache.org/viewvc/james/server/trunk/src/java/org/apache/james/util/connection/ServerConnection.java?view=diff&rev=471243&r1=471242&r2=471243
==============================================================================
--- james/server/trunk/src/java/org/apache/james/util/connection/ServerConnection.java (original)
+++ james/server/trunk/src/java/org/apache/james/util/connection/ServerConnection.java Sat
Nov  4 10:28:53 2006
@@ -263,6 +263,8 @@
                 runnerPool.put(clientConnectionRunner);
             }
         }
+
+        synchronized (this) { notify(); } // match the wait(...) in the run() inner loop
before accept().
     }
 
     /**
@@ -343,7 +345,13 @@
             try {
                 Socket clientSocket = null;
                 try {
+                    while (maxOpenConn > 0 && clientConnectionRunners.size() >=
maxOpenConn) {
+                        getLogger().warn("Maximum number of open connections (" +  clientConnectionRunners.size()
+ ") in use.");
+                        synchronized (this) { wait(10000); }
+                    }
+
                     clientSocket = serverSocket.accept();
+
                 } catch( InterruptedIOException iioe ) {
                     // This exception is expected upon ServerConnection shutdown.
                     // See the POLLING_INTERVAL comment



---------------------------------------------------------------------
To unsubscribe, e-mail: server-dev-unsubscribe@james.apache.org
For additional commands, e-mail: server-dev-help@james.apache.org


Mime
View raw message