Github user leighst commented on a diff in the pull request:

    
https://github.com/apache/incubator-distributedlog/pull/21#discussion_r88678281
  
    --- Diff: 
distributedlog-protocol/src/main/java/com/twitter/distributedlog/EnvelopedRecordSetWriter.java
 ---
    @@ -139,42 +145,43 @@ public synchronized ByteBuffer getBuffer() {
         }
     
         ByteBuffer createBuffer() {
    -        byte[] data = buffer.getData();
    +        ByteBuffer data = buffer.getData();
             int dataOffset = HEADER_LEN;
             int dataLen = buffer.size() - HEADER_LEN;
     
             if (COMPRESSION_CODEC_LZ4 != codecCode) {
    -            ByteBuffer recordSetBuffer = ByteBuffer.wrap(data, 0, 
buffer.size());
    +            ByteBuffer recordSetBuffer = data;
    --- End diff --
    
    i think it would be cleaner if you duplicate() the buffer.. its a little 
confusing to simply create a new reference. 


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---

Reply via email to