johnyangk commented on a change in pull request #222: [NEMO-350] Implement
Off-heap SerializedMemoryStore & [NEMO-384] Implement
DirectByteBufferInputStream for Off-heap SerializedMemoryStore
URL: https://github.com/apache/incubator-nemo/pull/222#discussion_r295141185
##########
File path:
runtime/executor/src/main/java/org/apache/nemo/runtime/executor/bytetransfer/ByteOutputContext.java
##########
@@ -157,12 +161,37 @@ public void write(final byte[] bytes, final int offset,
final int length) throws
* @return {@code this}
* @throws IOException when an exception has been set or this stream was
closed
*/
- public ByteOutputStream writeSerializedPartition(final SerializedPartition
serializedPartition)
+ public ByteOutputStream writeSerializedPartitionBuffer(final
SerializedPartition serializedPartition)
throws IOException {
- write(serializedPartition.getData(), 0, serializedPartition.getLength());
+ writeBuffer(serializedPartition.getBuffer());
return this;
}
+ /**
+ * Wraps each of the {@link ByteBuffer} in the bufList to {@link ByteBuf}
object
+ * to write a data frame.
+ *
+ * @param bufList
+ * @throws IOException
+ */
+ public void writeBuffer(final List<ByteBuffer> bufList) throws IOException
{
+ final ByteBuf byteBuf = wrappedBuffer(bufList.toArray(new
ByteBuffer[bufList.size()]));
Review comment:
It is nice that we can transfer off-heap data via Netty without copying the
data. 👍
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services