code: public Object prepare(Xid xid, List<? extends TransactionBranchInfo> branches) throws LogException {
          int branchCount = branches.size();
          byte[][] data = new byte[3 + 2 * branchCount][];
          data[0] = intToBytes(xid.getFormatId());
          data[1] = xid.getGlobalTransactionId();
          data[2] = xid.getBranchQualifier();
          int i = 3;
          for (TransactionBranchInfo transactionBranchInfo : branches) {
              data[i++] = transactionBranchInfo.getBranchXid().getBranchQualifier();
              data[i++] = transactionBranchInfo.getResourceName().getBytes();
          }
          try {
              return logger.putCommit(data);
          } catch (LogClosedException | LogRecordSizeException | InterruptedException | LogFileOverflowException e) {
              throw new IllegalStateException(e);
          } catch (IOException e) {
              throw new LogException(e);
          }
      }
docs: Prepares a transaction
  @param xid the id
  @param branches  the branches
  @return the log mark to use in commit/rollback calls.
  @throws LogException on error