Code Review 7010903: impl. of http.maxConnections is different from the description in JavaSE document
Chris Hegarty
chris.hegarty at oracle.com
Fri Jan 14 07:48:19 PST 2011
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.
More information about the net-dev
mailing list