asafm commented on code in PR #21816: URL: https://github.com/apache/pulsar/pull/21816#discussion_r1439280519
########## managed-ledger/src/main/java/org/apache/bookkeeper/mledger/impl/ManagedCursorContainer.java: ########## @@ -204,6 +281,24 @@ public ManagedCursor getSlowestReader() { } } + /** + * @return Returns the CursorInfo for the cursor with the oldest position, + * or null if there aren't any tracked cursors + */ + public CursorInfo getCursorWithOldestPosition() { + long stamp = rwLock.readLock(); + try { + if (heap.isEmpty()) { + return null; + } else { + Item item = heap.get(0); Review Comment: @dragosvictor answered [here](https://github.com/apache/pulsar/pull/21816#discussion_r1437844593). Actually it is possible to remove from a PriorityQueue. The cost complexity seems both O(N). -- 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: commits-unsubscr...@pulsar.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org