But then the compiler or IDE balks that you haven't dealt with the checked InterruptedException.
但是编译器或IDE报错说没有处理检查到的InterruptedException。
When a blocking method detects interruption and throws InterruptedException, it clears the interrupted status.
当一个阻塞方法检测到中断并抛出InterruptedException时,它清除中断状态。
Sometimes throwing InterruptedException is not an option, such as when a task defined by Runnable calls an interruptible method.
有时候抛出InterruptedException并不合适,例如当由Runnable定义的任务调用一个可中断的方法时,就是如此。
应用推荐