There are some subtle differences between the Thread (Thread API Document) methods interrupted() and isInterrupted():
Click below links to know more
- The interrupted() is a static method in Thread class that determines if the current thread has been interrupted. "The interrupted status of the thread is cleared by this method". Therefore, if a thread was interrupted, calling interrupted() once would return true, while a second call to it would return false until the current thread is interrupted again.
- The isInterrupted() is an instance method that tests if this thread instance has been interrupted. "The interrupted status of the thread is unaffected by this method".
Click below links to know more
Comments
Post a Comment