Where do I start investigating my Java process that won't end? Where do I start investigating my Java process that won't end? multithreading multithreading

Where do I start investigating my Java process that won't end?


You need to do one of two things to terminate your ExecutorService thread:

  1. Specify a ThreadFactory that creates daemon threads (the ThreadFactoryBuilder class from Guava will make this easier.)
  2. Call shutdown() on your ExecutorService as part of the application shutdown (e.g. at the end of your main method.)


Thread dumps and debuggers would be my guess.


Not sure how large the application is but I would check all the Threads you've created and ensure that their run methods are cleanly exited when the application is done executing. Somewhere, within a thread, you may have code along the lines of:

public void run() {    while(true) { //"true" or some condition that never gets a chance to be false        //do thread related work    }}