RFR: 8245095: Implementation of JEP 408: Simple Web Server
dfuchs at openjdk.java.net
Tue Sep 14 16:22:03 UTC 2021
On Tue, 14 Sep 2021 16:07:21 GMT, Julia Boes <jboes at openjdk.org> wrote:
>> src/jdk.httpserver/share/classes/com/sun/net/httpserver/Headers.java line 288:
>>> 286: }
>>> 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.
Or you could possibly define the constant in UnmodifiableHeaders instead.
More information about the core-libs-dev