private static final Logger LOG = Logger.getLogger(SerializeUtils.class);
public static Record deserializeTxn(InputArchive ia, TxnHeader hdr)
throws IOException {
hdr.deserialize(ia, "hdr");
Record txn = null;
switch (hdr.getType()) {
case OpCode.createSession:
// This isn't really an error txn; it just has the same
// format. The error represents the timeout
txn = new CreateSessionTxn();
break;
case OpCode.closeSession:
return null;
case OpCode.create:
txn = new CreateTxn();
break;
case OpCode.delete:
txn = new DeleteTxn();
break;
case OpCode.setData:
txn = new SetDataTxn();
break;
case OpCode.setACL:
txn = new SetACLTxn();
break;
case OpCode.error:
txn = new ErrorTxn();
break;
}
if (txn != null) {
txn.deserialize(ia, "txn");
}
return txn;
}