I am using ExecutorService
(Globally declared) to run multithread at the same time.
ExecutorService
will take one hour to complete the task.
So I need to get the currently running thread details like active thread, queued thread and completed thread.
And when I kill the ExecutorService
, the ExecutorService
killed but the thread running in background. So before kill the ExecutorService , I need to get the thread object form ExecutorService
and kill the thread manually using loop or iterator.
For Example:
ExecutorService has 5 threads.
Each thread has execute by invokeall(). Each thread will end after one hour.
But thing is I need to stop within 15 minutes by sending new request to server or call some method.
Here shutdown or shutdowNow stop the executor but not those 5 threads. That is the problem. So I need to kill those threads manually. How to kill the threads manually attached in executor service?