[ISSUE #6518] Fix bug that multi-threaded using bytebuffer

Co-authored-by: guyinyou <guyinyou.gyy@alibaba-inc.com>
This commit is contained in:
guyinyou
2023-03-31 17:03:37 +08:00
committed by GitHub
co-authored by guyinyou
parent 526a107557
commit e7f29798ec
@@ -2885,7 +2885,7 @@ public class DefaultMessageStore implements MessageStore {
BatchDispatchRequest task = batchDispatchRequestQueue.peek();
batchDispatchRequestExecutor.execute(() -> {
try {
ByteBuffer tmpByteBuffer = task.byteBuffer.duplicate();
ByteBuffer tmpByteBuffer = task.byteBuffer;
tmpByteBuffer.position(task.position);
tmpByteBuffer.limit(task.position + task.size);
List<DispatchRequest> dispatchRequestList = new ArrayList<>();
@@ -3018,7 +3018,7 @@ public class DefaultMessageStore implements MessageStore {
return;
}
mappedPageHoldCount.getAndIncrement();
BatchDispatchRequest task = new BatchDispatchRequest(byteBuffer, position, size, batchId++);
BatchDispatchRequest task = new BatchDispatchRequest(byteBuffer.duplicate(), position, size, batchId++);
batchDispatchRequestQueue.offer(task);
}