Imagine the following scenario:
There are multiple clients and same message is dispatched to all of them. Now the message can be a single string, or, it can be a more complex object.
Since the MessageToByteEncoder.encode's output will result in the same byte buffer each and every time, why not actually call the operation just once and then write that out buffer to each channel.
This is important not only for sparing some system resource. Also imagine I have an message pool that I reuse, so if I decode particular message once, I know when I can "release" it.
Otherwise I'll need to trace whether it has been written to all receiving channels and "release" then.
Thanks