0

有一个工人阶级正在执行任务。代码片段如下:

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");
     }    

 }

}

在这里,当我在睡眠模式下停止工人班时,据我所知,应该抛出中断异常。但实际上,并非如此。相反,它只是停止。有人可以澄清我的误解。我已经看到很多与这个问题相关的线程,但我的疑问还不清楚

4

0 回答 0