[improve][ml] Reduce unnecessary calling `span()` when filtering read entries.
@@ -2326,8 +2326,8 @@ public class ManagedCursorImpl implements ManagedCursor {
log.debug("[{}] [{}] Filtering entries {} - alreadyDeleted: {}", ledger.getName(), name, entriesRange,
individualDeletedMessages);
}
- if (individualDeletedMessages.isEmpty() || individualDeletedMessages.span() == null
- || !entriesRange.isConnected(individualDeletedMessages.span())) {
+ Range<PositionImpl> span = individualDeletedMessages.isEmpty() ? null : individualDeletedMessages.span();
+ if (span == null || !entriesRange.isConnected(span)) {
// There are no individually deleted messages in this entry list, no need to perform filtering
if (log.isDebugEnabled()) {
log.debug("[{}] [{}] No filtering needed for entries {}", ledger.getName(), name, entriesRange);
