Here you can find the source of getXidSize(Xid xid)
public static int getXidSize(Xid xid)
//package com.java2s; /*-/* w ww. j a v a 2 s . c o m*/ * See the file LICENSE for redistribution information. * * Copyright (c) 2002-2010 Oracle. All rights reserved. * */ import javax.transaction.xa.Xid; public class Main { public static final int INT_BYTES = 4; /** * The byte[]'s in Xid's are known to be 255 or less in length. So instead * of using read/writeByteArray(), we can save 6 bytes per record by making * the byte[] length be 1 byte instead of 4. */ public static int getXidSize(Xid xid) { byte[] gid = xid.getGlobalTransactionId(); byte[] bqual = xid.getBranchQualifier(); return INT_BYTES + // FormatId 1 + // gxid length byte 1 + // bqual length byte (gid == null ? 0 : gid.length) + // gid bytes (bqual == null ? 0 : bqual.length); // bqual bytes } }