About what class exactly are you talking, I guess you mean java.util.concurrent.ThreadPoolExecutor?
When you call shutdown(), then that will not immediately stop all the threads that are running in the ThreadPoolExecutor. It only means that it will stop accepting new tasks, but the tasks that are currently running will continue to run. I don't know what your threads are doing, but if they are running long-running tasks, then you will have to implement your own mechanism to tell those tasks to stop.
When you call shutdownNow(), the
thread pool will attempt to stop all running tasks by interrupting the tasks. If a task running in one of the threads is blocked in some blocking operation (for example waiting for input), then an InterruptedException will happen in the thread. The task then has to make sure that it stops.
So, it's not just a matter of calling shutdown() or shutdownNow(). You also have to make sure that your tasks running in the thread pool will stop if they are asked to stop, otherwise they will just keep on running.
Normally you would do something like this to shutdown the ThreadPoolExecutor: