jerrypeng commented on a change in pull request #6787:
URL: https://github.com/apache/pulsar/pull/6787#discussion_r413180924



##########
File path: 
managed-ledger/src/main/java/org/apache/bookkeeper/mledger/impl/ManagedCursorContainer.java
##########
@@ -164,6 +175,22 @@ public ManagedCursor getSlowestReader() {
         }
     }
 
+    public boolean hasCursors() {
+        long stamp = rwLock.tryOptimisticRead();
+        boolean isEmpty = cursors.isEmpty();
+        if (!rwLock.validate(stamp)) {
+            // Fallback to read lock
+            stamp = rwLock.readLock();
+            try {
+                isEmpty = cursors.isEmpty();

Review comment:
       Ya just used the same logic as "isEmpty" but the name of the method 
hints at a different semantic meaning.




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

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


Reply via email to