RFR: 8266897: com/sun/net/httpserver/FilterTest.java fails intermittently with AssertionError

Julia Boes jboes at openjdk.java.net
Mon May 17 10:01:18 UTC 2021

The tests for `afterHandler` filters expect the filter operation to happen before the assertion. Very rarely this is not the case, the calling thread reads the response before the filter operation is executed, so the test value is not set before it is asserted. 
This fix uses a `CompletableFuture` to ensure the test value has been updated before it is asserted.

While here, the change increases the thread-safety of the filter state of a context.


Commit messages:
 - Merge branch 'master' into 8266897
 - Use CompletableFuture in test and use concurrent collections to hold filters

Changes: https://git.openjdk.java.net/jdk/pull/4050/files
 Webrev: https://webrevs.openjdk.java.net/?repo=jdk&pr=4050&range=00
  Issue: https://bugs.openjdk.java.net/browse/JDK-8266897
  Stats: 31 lines in 3 files changed: 3 ins; 4 del; 24 mod
  Patch: https://git.openjdk.java.net/jdk/pull/4050.diff
  Fetch: git fetch https://git.openjdk.java.net/jdk pull/4050/head:pull/4050

PR: https://git.openjdk.java.net/jdk/pull/4050

More information about the net-dev mailing list