RFR: 8355370: Include server name in HTTP test server thread names to improve diagnostics [v2]

Volkan Yazici vyazici at openjdk.org
Thu Apr 24 07:24:36 UTC 2025


> Incorporates the test server name while deriving the HTTP/2 test server (i.e., `jdk.httpclient.test.lib.http2.Http2TestServer`) thread names to improve diagnostics.
> 
> ### Making `HttpTestServer` implement `AutoCloseable`
> 
> I carried out this out-of-scope enhancement along with this PR, since this one-liner gives nice try-with-resources convenience while writing tests using HTTP test servers. Note that [this change is already implemented for the in-progress HTTP/3 work](/dfuch/jdk/blob/9c2da664d2875b7e7986831fd716d05b7a8306f4/test/jdk/java/net/httpclient/lib/jdk/httpclient/test/lib/common/HttpServerAdapters.java#L1119).
> 
> ### Improving HTTP/2 test server thread names
> 
> The HTTP/2 server thread names are improved by modifying the server default executor to include the HTTP/2 server name in its thread names. We deliberately did nothing for the HTTP/1.1 server (provided by the `jdk.httpserver` module). `ServerImpl`, the default HTTP/1.1 server implementation, has only one thread by default: the dispatcher and it is named `HTTP-Dispatcher`. Since factory methods in `com.sun.net.httpserver.Http[s]Server` don’t have the notion of a _name_, introducing a name would require a public API change.
> Instead the calling code that creates the server can supply an Executor which creates threads with whatever name
> is appropriate for the application/test.

Volkan Yazici has updated the pull request incrementally with two additional commits since the last revision:

 - Fix code typo
 - Override `AutoCloseable::close` in `Http2TestServerImpl`

-------------

Changes:
  - all: https://git.openjdk.org/jdk/pull/24822/files
  - new: https://git.openjdk.org/jdk/pull/24822/files/445468b0..ccc7b0f6

Webrevs:
 - full: https://webrevs.openjdk.org/?repo=jdk&pr=24822&range=01
 - incr: https://webrevs.openjdk.org/?repo=jdk&pr=24822&range=00-01

  Stats: 7 lines in 1 file changed: 7 ins; 0 del; 0 mod
  Patch: https://git.openjdk.org/jdk/pull/24822.diff
  Fetch: git fetch https://git.openjdk.org/jdk.git pull/24822/head:pull/24822

PR: https://git.openjdk.org/jdk/pull/24822


More information about the net-dev mailing list