impl. of http.maxConnections is different from the description in JavaSE document

XMLWordPrintable

    • b128
    • generic
    • generic
    • Verified

      As to http.maxConnections, the document says as follows.

      ---

      http.maxConnections (default: 5)
          If HTTP keep-alive is enabled, this value is the number of idle connections that will be simultaneously kept alive, per-destination.

      ( http://download.oracle.com/javase/6/docs/technotes/guides/net/properties.html)
      -----

      The followings are the source code portion where the above-mentioned is implemented.

      -------j2se/src/share/classes/sun/net/www/http/KeepAliveCache.java (jdk6u23)----
      ...

      249 /* return a still valid, unused HttpClient */
      250 synchronized void put(HttpClient h) {
      251 if (size() > KeepAliveCache.getMaxConnections()) {
      252 h.closeServer(); // otherwise the connection remains in limbo
      253 } else {
      254 push(new KeepAliveEntry(h, System.currentTimeMillis()));
      255 }
      256 }
      ...
      -------------------------------------------

      At the line#251, the compare condition is "greater than".
      This seems that the program can cache(keep alive) the number of http.maxConnections+1.

            Assignee:
            Chris Hegarty
            Reporter:
            Tadayuki Baba (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: