posted 13 years ago
Rituka, what they are trying to tell you is to use a tag code around your code. You can do it just selecting the code and pressing the "code" button right above the message editor. So, the resulting code will be like this:
Nice, ahn?
Anyway, have your read a lot about threading? It's quite hard to understand when you're beginning and it will help you to understand what is going on.
You must know there is no way to stop a thread from running. When you call interrupt() method, you are saying "Please, Mr. Thread, stop from running". Technically, it's done by putting an internal flag in that thread telling it is interrupted, almost as you have called an imaginary setter method setInterrupted(true). So, the impact is every blocking method will immediately throw an exception. If there was no catch, the run() would be interrupted, but since you have catch the exception, your thread is not interrupted anymore. You have put the thread back into life and there is no reason to interrupted() return true. Therefore, when you catch an InterruptedException, you are calling an imaginary setter method setInterrupted(false) because your thread is alive again.
--eduardo