I have read a lot of questions and answers in StackOverflow
about interrupting Threads by throwing InterruptedException
.
But most of the answers are using just a for
loop and from time to time they check if the thread is interrupted with : Thread.currentThread().isInterrupted()
.
My code is like :
public class UploadVideoRunnable implements Runnable {
@Override
public void run() {
isUploaded = new uploadMedia(title, uri);
}
}
How/Where should I add code to check if thread is interrupted?
Sorry if this is a noob question but I have searched google a lot and haven't found an answer.
Thanks
EDIT : updated code, uploadMedia is a class and not a method