private void setupHeartBeatThread() {
    // start heartbeat thread
    ThreadFactory threadFactory = new ThreadFactoryBuilder().setDaemon(true)
        .setNameFormat("HiveStreamingConnection-Heartbeat-Thread")
        .build();
    this.scheduledExecutorService = Executors.newSingleThreadScheduledExecutor(threadFactory);
    long heartBeatInterval;
    long initialDelay;
    try {
      // if HIVE_TXN_TIMEOUT is defined, heartbeat interval will be HIVE_TXN_TIMEOUT/2
      heartBeatInterval = DbTxnManager.getHeartbeatInterval(conn.getConf());
    } catch (LockException e) {
      heartBeatInterval = DEFAULT_HEARTBEAT_INTERVAL;
    }
    // to introduce some randomness and to avoid hammering the metastore at the same time (same logic as DbTxnManager)
    initialDelay = (long) (heartBeatInterval * 0.75 * Math.random());
    LOG.info("Starting heartbeat thread with interval: {} ms initialDelay: {} ms for agentInfo: {}",
        heartBeatInterval, initialDelay, conn.getAgentInfo());
    Runnable runnable = new HeartbeatRunnable(conn, minTxnId, maxTxnId, transactionLock, isTxnClosed);
    this.scheduledExecutorService.scheduleWithFixedDelay(runnable, initialDelay, heartBeatInterval, TimeUnit
        .MILLISECONDS);
  }
Represents a batch of transactions acquired from MetaStore.

@param conn - hive streaming connection
@throws StreamingException if failed to create new RecordUpdater for batch
streaming/src/java/org/apache/hive/streaming/TransactionBatch.java