RFR: 8278398: jwebserver: Add test to confirm maximum request time
Jaikiran Pai
jpai at openjdk.java.net
Thu Jan 13 04:58:27 UTC 2022
On Wed, 12 Jan 2022 16:59:14 GMT, Julia Boes <jboes at openjdk.org> wrote:
> This new test confirms that the jwebserver does not wait indefinitely for a request to arrive, but instead closes the connection when the maximum request time is reached. To facilitate this, Exchange::run is amended to process cancelled keys in the case where the current thread is the dispatcher thread (which is the case for the jwebserver).
>
> Testing: tier 1-3 all clear.
src/jdk.httpserver/share/classes/sun/net/httpserver/ServerImpl.java line 525:
> 523: logger.log(Level.TRACE, "exchange started");
> 524:
> 525: if (dispatcherThread != null && dispatcherThread == Thread.currentThread()) {
Hello Julia,
Minor thing - With the `dispatcherThread == Thread.currentThread()` check, the `dispatcherThread != null` would be redundant and perhaps can be removed?
test/jdk/com/sun/net/httpserver/simpleserver/jwebserver/MaxRequestTimeTest.java line 104:
> 102: sendHTTPRequest(); // server expected to respond successfully
> 103:
> 104: p.destroy();
Since the `sendXXXRequest()` methods above could potentially throw exceptions, do you think it would be better to destroy the process in a finally block? Or maybe manage the process start and destroy as testng before/after lifecycle methods?
-------------
PR: https://git.openjdk.java.net/jdk/pull/7052
More information about the net-dev
mailing list