Skip to content

Commit

Permalink
Fix bug, DirectByteBuffer dose not have a backed java array
Browse files Browse the repository at this point in the history
  • Loading branch information
dongeforever committed Mar 1, 2017
1 parent ff379f4 commit eb1a5e7
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion store/src/main/java/org/apache/rocketmq/store/CommitLog.java
Original file line number Diff line number Diff line change
Expand Up @@ -1435,7 +1435,9 @@ public AppendMessageResult doAppend(final long fileFromOffset, final ByteBuffer
messagesByteBuff.position(msgPos + msgLen);
}

byteBuffer.put(messagesByteBuff.array(), 0, totalMsgLen);
messagesByteBuff.position(0);
messagesByteBuff.limit(totalMsgLen);
byteBuffer.put(messagesByteBuff);
messageExtBatch.setEncodedBuff(null);
AppendMessageResult result = new AppendMessageResult(AppendMessageStatus.PUT_OK, wroteOffset, totalMsgLen, msgIdBuilder.toString(),
messageExtBatch.getStoreTimestamp(), beginQueueOffset, CommitLog.this.defaultMessageStore.now() - beginTimeMills);
Expand Down

0 comments on commit eb1a5e7

Please sign in to comment.