private static LockRequest createLockRequest(final HiveStreamingConnection conn,
      String partNameForLock, String user, long txnId, String agentInfo) {
    LockRequestBuilder requestBuilder = new LockRequestBuilder(agentInfo);
    requestBuilder.setUser(user);
    requestBuilder.setTransactionId(txnId);

    LockComponentBuilder lockCompBuilder = new LockComponentBuilder()
        .setDbName(conn.getDatabase())
        .setTableName(conn.getTable().getTableName())
        .setSharedRead()
        .setOperationType(DataOperationType.INSERT);

    boolean isLocklessReadsEnabled = conn.getConf().getBoolVar(HiveConf.ConfVars.HIVE_ACID_LOCKLESS_READS_ENABLED);
    boolean sharedWrite = !conn.getConf().getBoolVar(HiveConf.ConfVars.TXN_WRITE_X_LOCK);

    if (sharedWrite || isLocklessReadsEnabled) {
      lockCompBuilder.setSharedWrite();
    }
    if (conn.isDynamicPartitioning()) {
      lockCompBuilder.setIsDynamicPartitionWrite(true);
    }
    if (partNameForLock != null && !partNameForLock.isEmpty()) {
      lockCompBuilder.setPartitionName(partNameForLock);
    }
    requestBuilder.addLockComponent(lockCompBuilder.build());

    return requestBuilder.build();
  }
Close the TransactionBatch.  This will abort any still open txns in this batch.

@throws StreamingException - failure when closing transaction batch
streaming/src/java/org/apache/hive/streaming/TransactionBatch.java