开发者

why did I get IllegalThreadStateException after calling this.interrupt()?

开发者 https://www.devze.com 2023-01-13 17:10 出处:网络
try { this.interrupt(); } catch (IllegalThreadStateException e) { e.printSta开发者_如何学运维ckTrace();
try {
    this.interrupt();
} catch (IllegalThreadStateException e) {
    e.printSta开发者_如何学运维ckTrace();
}

I found out that an IllegalThreadStateException was thrown by putting print statement, no stack trace was printed. I have tried searching existing threads about Thread.interrupt() and IllegalThreadStateException, but didn't get much out of them. I am using CDLC 1.1, if it helps. thank you very much!!


CLDC 1.1 is supposed to support interrupt(), but CLDC 1.0 didn't. Maybe your particular implementation didn't feel like adding this support, and fakes it by throwing a runtime exception.


If no stack trace is printed, it sounds like there error is happening (and being handled) elsewhere. Can you step through the code in a debugger and see if that interrupt is triggering another thread to have a problem? It would have to occur with the process of executing interrupt().

In our IDE, I would put a breakpoint on that line, hit F5 to step inside the method call, then continue stepping inside until I found the problem. Along the way, if I get to a point where there is no source code I would download the related source jar file and point the debugger to it (which sounds involved but only takes about 2 minutes).

Hope that helps in some way,

-gMale

0

精彩评论

暂无评论...
验证码 换一张
取 消