merlimat opened a new pull request, #4835:
URL: https://github.com/apache/bookkeeper/pull/4835
### Motivation
After every journal flush, a second pass iterates the whole `toFlush` list
purely to emit per-entry DEBUG trace lines. When DEBUG is disabled (the normal
production configuration), the loop still runs: it allocates an `Iterator` per
flush and walks the full list doing null checks for nothing.
### Changes
Wrap the trace loop in slog's lazy consumer form, `log.debug(e -> { ... })`,
which returns immediately without invoking the consumer when DEBUG is disabled
— no iteration, no iterator. A local alias of `toFlush` is captured since the
field variable is reassigned after the hand-off to the force-write thread (not
effectively final).
Verified with `BookieJournalTest` and `BookieJournalForceTest` (22/22 pass)
and module checkstyle.
--
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]