Created
October 9, 2018 21:45
-
-
Save kasramp/00ee8044ef8d7ebe8f94cb177ccf246f to your computer and use it in GitHub Desktop.
A Runnable example with interruption handling
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class DummyRunnable implements Runnable { | |
@Override | |
public void run() { | |
for(long i=0; i<=10000000;i++) { | |
System.out.println(i); | |
if(Thread.currentThread().isInterrupted()) { | |
return; | |
} | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment