The RejectedExecutionException was thrown when the thread executing 
`Server.start` managed to shut down the `compilerThreadPool` before the thread 
executing `Server.handleRequest` submitted the compilation task.

This patch removes the extra thread used for `Server.handleRequest`, and 
executes that method directly in the thread pool. All `compilerThreadPool` uses 
happen on the `Server.start` thread now, and no new tasks are submitted after 
the thread pool is shut down.

In order to verify the fix, I modified `IdleMonitor.KEEPALIVE` to 1 second. 
With that change the problem was occasionally reproducible without the patch 
from this PR. With the patch, the `RejectedExecutionException` problem did not 
reproduce. 

No new regression test. Existing langtools tests continue to pass.

-------------

Commit messages:
 - Use threadpool for socket communication

Changes: https://git.openjdk.org/jdk/pull/18672/files
  Webrev: https://webrevs.openjdk.org/?repo=jdk&pr=18672&range=00
  Issue: https://bugs.openjdk.org/browse/JDK-8324673
  Stats: 19 lines in 2 files changed: 1 ins; 10 del; 8 mod
  Patch: https://git.openjdk.org/jdk/pull/18672.diff
  Fetch: git fetch https://git.openjdk.org/jdk.git pull/18672/head:pull/18672

PR: https://git.openjdk.org/jdk/pull/18672

Reply via email to