* @throws java.io.IOException thrown if an error occurs
*/
public void writePacket(Packet packet, DataOutput dataOut) throws IOException {
super.writePacket(packet, dataOut);
XATransactionInfo info = (XATransactionInfo) packet;
dataOut.writeByte(info.getType());
switch (info.getType()) {
case TransactionType.START:
case TransactionType.PRE_COMMIT:
case TransactionType.COMMIT:
case TransactionType.RECOVER:
case TransactionType.ROLLBACK:
case TransactionType.END:
case TransactionType.FORGET:
case TransactionType.JOIN:
case TransactionType.COMMIT_ONE_PHASE:
assert info.getXid() != null;
info.getXid().write(dataOut);
break;
case TransactionType.SET_TX_TIMEOUT:
dataOut.writeInt(info.getTransactionTimeout());
break;
case TransactionType.XA_RECOVER:
//recover should take a flag.
break;
case TransactionType.GET_TX_TIMEOUT:
case TransactionType.GET_RM_ID:
break;
default:
throw new IllegalArgumentException("Invalid type code: " + info.getType());
}
}