public synchronized HiveTxnManager initTxnMgr(HiveConf conf) throws LockException {
    // Only change txnMgr if the setting has changed
    if (txnMgr != null &&
        !txnMgr.getTxnManagerName().equals(conf.getVar(HiveConf.ConfVars.HIVE_TXN_MANAGER))) {
      txnMgr.closeTxnManager();
      txnMgr = null;
    }

    if (txnMgr == null) {
      txnMgr = TxnManagerFactory.getTxnManagerFactory().getTxnManager(conf);
    }
    return txnMgr;
  }
Initialize the transaction manager.  This is done lazily to avoid hard wiring one
transaction manager at the beginning of the session.
@param conf Hive configuration to initialize transaction manager
@return transaction manager
@throws LockException
ql/src/java/org/apache/hadoop/hive/ql/session/SessionState.java