[ https://issues.apache.org/jira/browse/DL-45?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15676979#comment-15676979 ]
ASF GitHub Bot commented on DL-45: ---------------------------------- 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. > DL should allow ByteBuffer based API and should avoid copying of arrays > ----------------------------------------------------------------------- > > Key: DL-45 > URL: https://issues.apache.org/jira/browse/DL-45 > Project: DistributedLog > Issue Type: Improvement > Components: distributedlog-core, distributedlog-protocol > Reporter: Arvind Kandhare > -- This message was sent by Atlassian JIRA (v6.3.4#6332)