Methods like and throw an to tell the caller that another thread has interrupted this thread. In most cases this is done in order to tell the current thread to stop its current computations and to finish them unexpectedly. Hence ignoring the exception by catching it and only logging it to the console or some log file is often not the appropriate way to handle this kind of exception. The problem with this exception is, that the method of the Runnable interface does not allow that throws any exceptions. So just rethrowing it does not help. This means the implementation of has to handle this checked exception itself and this often leads to the fact that it its caught and ignored.
No comments:
Post a Comment