@VisibleForTesting
  public HiveTxnManager setTxnMgr(HiveTxnManager mgr) {
    if(!(sessionConf.getBoolVar(ConfVars.HIVE_IN_TEST) || sessionConf.getBoolVar(ConfVars.HIVE_IN_TEZ_TEST))) {
      throw new IllegalStateException("Only for testing!");
    }
    HiveTxnManager tmp = txnMgr;
    txnMgr = mgr;
    return tmp;
  }
This only for testing.  It allows to switch the manager before the (test) operation so that
it's not coupled to the executing thread.  Since tests run against Derby which often wedges
under concurrent access, tests must use a single thead and simulate concurrent access.
For example, {@code TestDbTxnManager2}
@return previous {@link HiveTxnManager} or null
ql/src/java/org/apache/hadoop/hive/ql/session/SessionState.java