I have thread application which process heavy task, i would like to trigger forcibly stop thread upon external flag information. I have tried following design,
public class HeavyTaskThread implements Runnable
{
private boolean forceStop;
public void run()
{
..
..
..
..
}
}
Another fact is i do not have control of logic flow implemented into method run(); which simply call some third-party program. I was trying with light inner thread class and calling method interrupt() on parent thread, but this does not work.
Please suggest any pattern....