These are the two ways to check for thread interruption:
1. In Java, a Thread can call Thread.interrupted() method to
check if it has been interrupted or not.
2. The other option is to call isInterrupted() method of
Thread class to check if it has been interrupted or not.
https://learning.oreilly.com/library/view/java-threads-second/1565924185/ch04s05.html