@Override
      public void run() {
        // 1st Cancel
        try {
          // Sleep for 100ms
          Thread.sleep(100);
          System.out.println("Cancelling query: ");
          stmt.cancel();
        } catch (Exception e) {
          // No-op
        }
        // 2nd cancel
        try {
          // Sleep for 5ms and cancel again
          Thread.sleep(5);
          System.out.println("Cancelling query again: ");
          stmt.cancel();
        } catch (Exception e) {
          // No-op
        }
      }
Test the cancellation of a query that is running.
We spawn 2 threads - one running the query and
the other attempting to cancel.
We're using a dummy udf to simulate a query,
that runs for a sufficiently long time.
@throws Exception
itests/hive-unit/src/test/java/org/apache/hive/jdbc/TestJdbcDriver2.java