a. How to Stop Or Kill Or Terminate a Single Thread in ExecutorService
?
b. How to Stop Or Kill Or Terminate the Job
which is running in ExecutorService
instead of the
Thread which is holding the job?
Thanks, Kathir
a. How to Stop Or Kill Or Terminate a Single Thread in ExecutorService
?
b. How to Stop Or Kill Or Terminate the Job
which is running in ExecutorService
instead of the
Thread which is holding the job?
Thanks, Kathir
It depends on what exactly you are doing in you job ( = in your Runnable
/ Callable
-implementation). If you are processing a list of items, you could check for a cancel-flag in between (which should be declared as volatile).
You could also use cancel(true) on your future object (when you are submitting a callable), but this as well would require that you test for Thread.currentThread().isInterrupted()
inside your job.
We also tracked the thread via socket programming.
Assume a call has been initiated from web app to third party application.
Initiating the request via a thread using socket programming
Whenever user wants to kill the thread, we can do it in socket programming as it holds the exact thread.
In Quartz there is no way we can kill a running thread.