@Override
  public void beforeEach(ExtensionContext context) throws Exception {
    if (!LOCK.tryLock(1, TimeUnit.MINUTES)) {
      throw new IllegalStateException("Lock acquisition failed cause another test is using the LlapDaemon.");
    }
    final String appName = "testLlapDaemon" + context.getUniqueId();
    HiveConf conf = new HiveConf();
    HiveConf.setVar(conf, HiveConf.ConfVars.LLAP_DAEMON_SERVICE_HOSTS, "llap");
    LlapDaemonInfo.initialize(appName, conf);
    daemon =
        new LlapDaemon(conf, 1, LlapDaemon.getTotalHeapSize(), false, false, -1, new String[1], 0, false, 0, 0, 0, 0,
            appName);
    daemon.init(conf);
    daemon.start();
  }
A JUnit Jupiter extension providing ready to use {@link LlapDaemon} for the duration of a test when the test method
has a parameter of the respective type.

A new daemon is created before each test and destroyed afterwards. The daemons rely on various static constructs so
we cannot have many in the same JVM. If there are many {@link LlapDaemon} parameters in the same test method the same
object is returned for all of them.

The class is thread-safe but there cannot be two tests using LLAP daemons concurrently for the reasons mentioned
previously.
llap-server/src/test/org/apache/hadoop/hive/llap/daemon/LlapDaemonExtension.java