Chris Hegarty wrote:
Michael,

Trivially, the number of keep-alive connections is not being correctly compared to the maximum number, set by http.maxConnections. The condition is "greater than" and allows the cache keep a number of http.maxConnections + 1.

hg diff src/share/classes/sun/net/www/http/KeepAliveCache.java
diff -r 694951adefec src/share/classes/sun/net/www/http/KeepAliveCache.java --- a/src/share/classes/sun/net/www/http/KeepAliveCache.java Thu Jan 13 13:24:58 2011 +0000 +++ b/src/share/classes/sun/net/www/http/KeepAliveCache.java Fri Jan 14 15:39:32 2011 +0000
@@ -267,7 +267,7 @@ class ClientVector extends java.util.Sta

     /* return a still valid, unused HttpClient */
     synchronized void put(HttpClient h) {
-        if (size() > KeepAliveCache.getMaxConnections()) {
+        if (size() >= KeepAliveCache.getMaxConnections()) {
h.closeServer(); // otherwise the connection remains in limbo
         } else {
             push(new KeepAliveEntry(h, System.currentTimeMillis()));

-Chris.
Looks fine.

- Michael.

Reply via email to