...
Transactions in a TransactionBatch are eventually expired by the Metastore if not committed or aborted after hive.txn.timeout secs secs. TrasnactionBatch class provides a heartbeat() method to prolong the lifetime of unused transactions in the batch. A good rule of thumb is to send call heartbeat() at (hive.txn.timeout/2) intervals after creating a TransactionBatch. This is sufficient to keep an inactive transaction alive but not load the metastore unnecessarily.
Note: Hive 1.3.0 onwards, invoking TxnBatch.close() will cause all unused transaction in the current TxnBatch to be aborted.
...