Since InterruptedException is a checked exception, we must catch it and/or throw it. A blocking thread is usually in a BLOCKED, WAITING, or TIMED_WAITING state, and if it is interrupted, then the method tries to throw InterruptedException as soon as possible. Why Do We Need Thread.currentThread().interrupt() in Interruptible Methods?Ä«y an interruptible method, we mean a blocking method that may throw InterruptedException, for example, Thread.sleep(), BlockingQueue.take(), BlockingQueue.poll(long timeout, TimeUnit unit), and so on.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |