-1

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

4

2 に答える 2

1

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.

于 2012-11-27T14:20:40.127 に答える
0

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.

于 2017-08-09T02:01:16.617 に答える