@Override
  public SettableFuture<WmTezSession> waitForAmRegistryAsync(
      int timeoutMs, ScheduledExecutorService timeoutPool) {
    final SampleTezSessionState session = this;
    final SettableFuture<WmTezSession> future = SettableFuture.create();
    Futures.addCallback(waitForAmRegFuture, new FutureCallback<Boolean>() {
      @Override
      public void onSuccess(Boolean result) {
        future.set(session);
      }

      @Override
      public void onFailure(Throwable t) {
        future.setException(t);
      }
    }, MoreExecutors.directExecutor());
    return future;
  }
This class is needed for writing junit tests. For testing the multi-session
use case from hive server 2, we need a session simulation.
ql/src/test/org/apache/hadoop/hive/ql/exec/tez/SampleTezSessionState.java