Hi

    Please oblige and review the changes in the webrev

http://cr.openjdk.java.net/~msheppar/8015692/jdk9/webrev/

to address the issue raised in the bug

https://bugs.openjdk.java.net/browse/JDK-8015692

Summary:
a series Junit tests which start stop instances of an com.sun.net.httpserver.HttpServer failed due to
java.net.BindException: Address already in use: bind

This was raised against Windows XP, but the sample test to reproduce the issue
was run on Windows 7, and the problem was seen to occur on this OS also.
The sample was run against jdk7, jdk8 and jdk9: reproducible on each.

On investigation it appears that some additional co-ordination is required between the HttpServer's (actually SereverImpl) dispatcher thread and the thread invoking the stop method. This change has amended the stop method to wait for the Dispatcher thread to complete, then invokes the selector's selectNow, to handled cancelled events, and closes the selector.
The selector.close() has been removed from the Dispatcher's run method.

regards
Mark

Reply via email to