eolivelli commented on code in PR #17241:
URL: https://github.com/apache/pulsar/pull/17241#discussion_r956142664


##########
managed-ledger/src/main/java/org/apache/bookkeeper/mledger/impl/cache/RangeEntryCacheImpl.java:
##########
@@ -256,6 +276,130 @@ public void asyncReadEntry(ReadHandle lh, long 
firstEntry, long lastEntry, boole
         }
     }
 
+    @AllArgsConstructor
+    private static final class ReadEntriesCallbackWithContext {
+        final ReadEntriesCallback callback;
+        final Object ctx;
+        final long startEntry;
+        final long endEntry;
+    }
+
+    private CachedPendingRead findBestCandidate(PendingReadKey key, 
Map<PendingReadKey, CachedPendingRead> ledgerCache,
+                                                AtomicBoolean created) {
+        synchronized (ledgerCache) {

Review Comment:
   I want to synchronize only on the Map that is for the specific "ledger", not 
on the whole RangeEntryCacheImpl
   this way the lock is more fine grained



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