inside run() methods, introduced a flag to check whether the runnable is
cancelled or not