On Tue, 21 Sep 2021 17:16:08 GMT, Michael McMahon <micha...@openjdk.org> wrote:
>> Julia Boes has updated the pull request with a new target base due to a >> merge or a rebase. The pull request now contains 16 commits: >> >> - Merge branch 'master' into simpleserver >> - Merge remote-tracking branch 'origin/simpleserver' into simpleserver >> - Merge branch 'master' into simpleserver >> - refactor isHidden,isReadable,isSymlink checks and cleanup tests >> - Merge branch 'master' into simpleserver >> - check isHidden, isSymlink, isReadable for all path segments >> - add checks for all path segments >> - Merge branch 'master' into componentcheck >> - Merge branch 'master' into simpleserver >> - improve output on startup >> - ... and 6 more: >> https://git.openjdk.java.net/jdk/compare/6d91a3eb...fe059131 > > src/jdk.httpserver/share/classes/sun/net/httpserver/simpleserver/SimpleFileServerImpl.java > line 135: > >> 133: var socketAddr = new InetSocketAddress(addr, port); >> 134: var server = SimpleFileServer.createFileServer(socketAddr, >> root, outputLevel); >> 135: server.setExecutor(Executors.newSingleThreadExecutor()); > > I think this code has the effect of creating one thread for the selector and > a second one for the execution of the handlers. If we want to keep thread > usage to an absolute minimum then it might be better to not set an executor. > Then, the selector thread executes the handlers as well. I did a quick stress test of both versions (with and without executor specified) and don’t see any difference in how many requests can be handled. Probably good to keep thread usage to a minimum, I'll update that. ------------- PR: https://git.openjdk.java.net/jdk/pull/5505