Skip to content

Instantly share code, notes, and snippets.

@kasramp
Created October 9, 2018 21:45
Show Gist options
  • Save kasramp/00ee8044ef8d7ebe8f94cb177ccf246f to your computer and use it in GitHub Desktop.
Save kasramp/00ee8044ef8d7ebe8f94cb177ccf246f to your computer and use it in GitHub Desktop.
A Runnable example with interruption handling
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