mattisonchao commented on code in PR #16910:
URL: https://github.com/apache/pulsar/pull/16910#discussion_r935071389


##########
managed-ledger/src/main/java/org/apache/bookkeeper/mledger/impl/ManagedCursorImpl.java:
##########
@@ -1347,7 +1347,7 @@ public Set<? extends Position> asyncReplayEntries(final 
Set<? extends Position>
     @Override
     public Set<? extends Position> asyncReplayEntries(Set<? extends Position> 
positions,
             ReadEntriesCallback callback, Object ctx, boolean sortEntries) {
-        List<Entry> entries = 
Lists.newArrayListWithExpectedSize(positions.size());
+        List<Entry> entries = Collections.synchronizedList(new 
ArrayList<>(positions.size()));

Review Comment:
   We will invoke the `entries.add` method at callback in the different 
threads. ( If we need to read entries from the different ledger.)



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

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to