异常转义try块

时间:2018-06-15 10:40:15

标签: android multithreading exception

这是我的开发者控制台的崩溃报告,这意味着崩溃已经发生并发送到谷歌:

Android 4.2
Report 1 of 1  

错误:

java.lang.InterruptedException: 
      at java.lang.VMThread.sleep (VMThread.java)
      at java.lang.Thread.sleep (Thread.java:1010)
      at java.lang.Thread.sleep (Thread.java:992)
      at xyz.Draw_movingpool (xyz.java:4677)
      at xyz.phone_turn_backgammon (xyz.java:13341)
      at xyz.Update (xyz.java:1786)
      at xyz.run (MainThread.java:30)

这是源代码:

long sleepTime = 30-((System.nanoTime()-beforeTime)/1000000L);
    try {
        if(sleepTime>0){
            Thread.sleep(sleepTime); //line:4677
        }
    }catch(InterruptedException e){ break;}

有人可以向我解释一下异常是如何逃过try块的吗?

Android Studio 3.1.2
Build sdk 27
JAVA 1_7

0 个答案:

没有答案