@Test
  public void testConcurrentLineage() throws Exception {
    // setup to run concurrent operations
    Statement stmt = conTestDb.createStatement();
    setSerializeInTasksInConf(stmt);
    stmt.execute("drop table if exists testConcurrentLineage1");
    stmt.execute("drop table if exists testConcurrentLineage2");
    stmt.execute("create table testConcurrentLineage1 (col1 int)");
    stmt.execute("create table testConcurrentLineage2 (col2 int)");

    // clear vertices list
    ReadableHook.clear();

    // run 5 sql inserts concurrently
    int numThreads = 5;        // set to 1 for single threading
    int concurrentCalls = 5;
    ExecutorService pool = Executors.newFixedThreadPool(numThreads);
    try {
      List<InsertCallable> tasks = new ArrayList<>();
      for (int i = 0; i < concurrentCalls; i++) {
        InsertCallable runner = new InsertCallable(conTestDb);
        tasks.add(runner);
      }
      List<Future<Void>> futures = pool.invokeAll(tasks);
      for (Future<Void> future : futures) {
        future.get(20, TimeUnit.SECONDS);
      }
      // check to see that the vertices are correct
      checkVertices();
    } finally {
      // clean up
      stmt.execute("drop table testConcurrentLineage1");
      stmt.execute("drop table testConcurrentLineage2");
      stmt.close();
      pool.shutdownNow();
    }
  }
A test that checks that Lineage is correct when a multiple concurrent
requests are make on a connection
itests/hive-unit/src/test/java/org/apache/hive/jdbc/TestJdbcWithMiniHS2.java