Answer the question
In order to leave comments, you need to log in
Answer the question
In order to leave comments, you need to log in
Simple enough: Interrupted - translated as interrupted.
Imagine the following situation: there are three threads 1 - the main one, does not depend on anyone, and the other two depend on each other. Let's say the second thread needs data that results from the execution of the third thread. Accordingly, we "put the second thread to sleep" and wait until the third one is executed, but when the third thread is executed, the situation turns out that it is necessary to suspend or interrupt the execution of the second and third threads, respectively, we stop the third thread, and call the second method interrupt () (interrupt). When the thread scheduler tries to resume the second thread, it will not be able to do so, because the second thread is interrupted, that's when this exception is obtained. The example is not very successful, please do not judge strictly.
With one little note
If you catch an InterruptedException but cannot rethrow it, then you must keep proof that the interrupt occurred so that code up the call stack can learn about the interrupt and react to it if it wants to. This task is done by calling interrupt() to "re-interrupt" the current thread
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question