There is a worker class which is executing the task. The code snippet is as follows:
public class Worker{
executor.execute( new Runnable() {
public void run() {
LOG.info("Task starting to execute");
try {
Thread.sleep(7000)`
}catch (InterruptedException)
LOG.info("Thread Interrupted");
}
LOG.info("Task Executed");
}
}
}
Here when i stop worker class when it is in sleep mode, as per my knowledge Interrupted Exception should be thrown. But in reality, it's not. Instead it just stops. Can someone please clarify my misconception. I have seen lots of threads related to this question, still my doubt is not clear