private byte[] encodeXid(XATransactionId xid, long seq, long priority) {
byte[] xidVal = xid.getEncodedXidBytes();
// encode the update
DataByteArrayOutputStream outputStream = xid.internalOutputStream();
outputStream.position(1);
outputStream.writeLong(seq);
outputStream.writeByte(Long.valueOf(priority).byteValue());
return xidVal;
}