Yangze Guo created FLINK-17331:
----------------------------------
Summary: Add NettyMessageContent interface for all the class which could be write to NettyMessage
Key: FLINK-17331
URL:
https://issues.apache.org/jira/browse/FLINK-17331 Project: Flink
Issue Type: Improvement
Reporter: Yangze Guo
Currently, there are some classes, e.g. {{JobVertexID}}, {{ExecutionAttemptID}} need to write to {{NettyMessage}}. However, the size of these classes in {{ByteBuf}} are directly written in {{NettyMessage}} class, which is error-prone. If someone edits those classes, there would be no warning or error during the compile phase. I think it would be better to add a {{NettyMessageContent}}(the name could be discussed) interface:
{code:java}
public interface NettyMessageContent {
void writeTo(ByteBuf bug)
int getContentLen();
}
{code}
Regarding the {{fromByteBuf}}, since it is a static method, we could not add it to the interface. We might explain it in the javaDoc of {{NettyMessageContent}}.
--
This message was sent by Atlassian Jira
(v8.3.4#803005)