@Before
  public void init() throws Exception {
    conf = new HiveConf();

    conf.setBoolVar(HIVE_SERVER2_METRICS_ENABLED, true);
    conf.setVar(HiveConf.ConfVars.DOWNLOADED_RESOURCES_DIR, System.getProperty("java.io.tmpdir"));
    conf.setTimeVar(HIVE_SERVER2_COMPILE_LOCK_TIMEOUT, 15, TimeUnit.SECONDS);

    MetricsFactory.close();
    MetricsFactory.init(conf);
  }
Class for testing HS2 compile lock behavior (serializable, parallel unbounded, parallel bounded).
ql/src/test/org/apache/hadoop/hive/ql/TestCompileLock.java