On Tue, 14 Sep 2021 13:47:48 GMT, Andrey Turbanov <github.com+741251+turban...@openjdk.org> wrote:
>> This change implements a simple web server that can be run on the >> command-line with `java -m jdk.httpserver`. >> >> This is facilitated by adding an entry point for the `jdk.httpserver` >> module, an implementation class whose main method is run when the above >> command is executed. This is the first such module entry point in the JDK. >> >> The server is a minimal HTTP server that serves the static files of a given >> directory, similar to existing alternatives on other platforms and >> convenient for testing, development, and debugging. >> >> Additionally, a small API is introduced for programmatic creation and >> customization. >> >> Testing: tier1-3. > > src/jdk.httpserver/share/classes/com/sun/net/httpserver/Headers.java line 288: > >> 286: } >> 287: >> 288: private static final Headers EMPTY = new UnmodifiableHeaders(new >> Headers()); > > IDEA warns here: >>Referencing subclass UnmodifiableHeaders from superclass Headers initializer >>might lead to class loading deadlock >>Such references can cause JVM-level deadlocks in multithreaded environment, >>when one thread tries to load the superclass and another thread tries to load >>the subclass at the same time. Interesting, thanks for noting. We can return a new instance instead on line 307, the only place the constant is used. ------------- PR: https://git.openjdk.java.net/jdk/pull/5505