[
https://issues.apache.org/jira/browse/FLINK-7411?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16152657#comment-16152657
]
ASF GitHub Bot commented on FLINK-7411:
---------------------------------------
Github user pnowojski commented on a diff in the pull request:
https://github.com/apache/flink/pull/4517#discussion_r136831126
--- Diff:
flink-runtime/src/main/java/org/apache/flink/runtime/io/network/netty/NettyMessage.java
---
@@ -313,20 +308,20 @@ ByteBuf write(ByteBufAllocator allocator) throws
IOException {
}
}
- @Override
- void readFrom(ByteBuf buffer) throws Exception {
+ static ErrorResponse readFrom(ByteBuf buffer) throws Exception {
try (ObjectInputStream ois = new ObjectInputStream(new
ByteBufInputStream(buffer))) {
Object obj = ois.readObject();
if (!(obj instanceof Throwable)) {
throw new ClassCastException("Read
object expected to be of type Throwable, " +
"actual type is " +
obj.getClass() + ".");
} else {
- cause = (Throwable) obj;
+ ErrorResponse result = new
ErrorResponse((Throwable) obj);
if (buffer.readBoolean()) {
- receiverId =
InputChannelID.fromByteBuf(buffer);
+ result.receiverId =
InputChannelID.fromByteBuf(buffer);
--- End diff --
ditto
> minor performance improvements in NettyMessage
> ----------------------------------------------
>
> Key: FLINK-7411
> URL: https://issues.apache.org/jira/browse/FLINK-7411
> Project: Flink
> Issue Type: Sub-task
> Components: Network
> Affects Versions: 1.4.0
> Reporter: Nico Kruber
> Assignee: Nico Kruber
> Priority: Minor
>
> {{NettyMessage}} may be improved slightly performance-wise in these regards:
> - in {{NettyMessage.NettyMessageDecoder#decode()}}: instead of having
> multiple if-elseif-... use a switch to cycle through the message ID
> - use a static {{NettyMessage}} subtype {{readFrom(ByteBuf buffer)}} - we do
> not really need to have a virtual function here
--
This message was sent by Atlassian JIRA
(v6.4.14#64029)