Code which I am trying
public void killJob(String thread_id)throws RemoteException{
Thread t1 = new Thread(a);
t1.suspend();
}
How can we suspend/pause thread based on its id? Thread.suspend is deprecated,There must be some alternative to achieve this. I have thread id I want to suspend and kill the thread.
Edit: I used this.
AcQueryExecutor a=new AcQueryExecutor(thread_id_id);
Thread t1 = new Thread(a);
t1.interrupt();
while (t1.isInterrupted()) {
try {
Thread.sleep(1000);
} catch (InterruptedException e) {
t1.interrupt();
return;
}
}
But I am not able to stop this thread.