You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@flink.apache.org by pnowojski <gi...@git.apache.org> on 2017/09/04 14:35:38 UTC
[GitHub] flink pull request #4518: [FLINK-7412][network] optimise NettyMessage.TaskEv...
Github user pnowojski commented on a diff in the pull request:
https://github.com/apache/flink/pull/4518#discussion_r136834211
--- Diff: flink-runtime/src/main/java/org/apache/flink/runtime/io/network/netty/NettyMessage.java ---
@@ -440,12 +440,11 @@ ByteBuf write(ByteBufAllocator allocator) throws IOException {
static TaskEventRequest readFrom(ByteBuf buffer, ClassLoader classLoader) throws IOException {
TaskEventRequest result = new TaskEventRequest();
- // TODO Directly deserialize fromNetty's buffer
+ // directly deserialize fromNetty's buffer
int length = buffer.readInt();
- ByteBuffer serializedEvent = ByteBuffer.allocate(length);
-
- buffer.readBytes(serializedEvent);
- serializedEvent.flip();
+ ByteBuffer serializedEvent = buffer.nioBuffer();
--- End diff --
`buffer.nioBuffer(buffer.readerIndex(), length);` ?
---