In NAKACK.handleXmitReq(), we wrap messages that are retransmitted. Every xmitted message gets serialized into a byte buffer, and is added as the payload of another message. When received, NAKACK.handleXmitRsp() de-serializes the message and passes it up.
We can get rid of this unneeded serialization/de-serialization:
- When a message is to be retransmitted with dest=null (use_mcast_xmit), we simply resend the message: the rceeiver will receive the message as if it was a regular message, and not an xmit. NAKACK.handleMessage() will be invoked.
- When dest != null, we make a copy of the message and replace the NakAckHeader.MSG with XMIT_RSP (plus seqno). When the message is received (handledd by NAKACK.handleXmitRsp() this time), we simply replace the XMIT_RSP with a MSG again, and pass the message up
When we have a lot of retransmissions, this will save 1 serialization when handling the xmit request, and 1 de-serialization when handling the xmit response. Even better when use_mcast_xmit=true: here, everybody has to de-serialize the xmitted message. With the proposed solution, this cost is gone