Thread Interruption

 

public class IsInterrupted extends Thread {
  @Override
  public void run() {
    //change the status of interrupted from true to false
    //only if thread is interrupted
    //interrupted() is a static method
    //can be invoked using thread.interrupted()
    System.out.println(Thread.interrupted()); //true->false
    //does not change the interrupted status
    //only gives the status
    //not a static method
    //have to be invoked using currentThread()
    System.out.println(Thread.currentThread().isInterrupted());
    try {
      for (int i = 1; i <= 5; i++) {
        System.out.println(i);
        Thread.sleep(1000);
      }
    } catch (Exception e) {
      System.out.println("Thread interrupted : " + e);
    }
  }

  public static void main(String[] args) {
    IsInterrupted ti = new IsInterrupted();
    ti.start();
    // ti.interrupt();
  }
}

Google Script for Data Entry Form in Google Spreadsheet

// function to validate the entry made by user in user form function validateEntry (){ // declare a variable and referernece of active goog...