johnyangk commented on a change in pull request #223: [NEMO-388] Off-heap 
memory management (reuse ByteBuffer)
URL: https://github.com/apache/incubator-nemo/pull/223#discussion_r310452579
 
 

 ##########
 File path: 
runtime/executor/src/main/java/org/apache/nemo/runtime/executor/bytetransfer/ByteOutputContext.java
 ##########
 @@ -247,8 +246,24 @@ private void writeDataFrame(final Object body, final long 
length) throws IOExcep
         throw new IOException("Stream already closed.");
       }
       
channel.writeAndFlush(DataFrameEncoder.DataFrame.newInstance(getContextId(), 
body, length, newSubStream))
+        .addListener((ChannelFutureListener) future -> {
+          if (future.isSuccess()) {
+            if (partitionToRelease != null) {
+              partitionToRelease.release();
+            }
+          }
+        })
         .addListener(getChannelWriteListener());
       newSubStream = false;
     }
+
+    /**
+     * Register the partition that should be released on completion of data 
transfer.
+     *
+     * @param partition to release on data transfer.
+     */
+    public void registerPartitionToRelease(final SerializedPartition 
partition) {
 
 Review comment:
   Please remove.

----------------------------------------------------------------
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

Reply via email to