BewareMyPower commented on a change in pull request #10330:
URL: https://github.com/apache/pulsar/pull/10330#discussion_r619591544
##########
File path:
managed-ledger/src/main/java/org/apache/bookkeeper/mledger/impl/ManagedLedgerImpl.java
##########
@@ -766,26 +766,24 @@ private synchronized void
internalAsyncAddEntry(OpAddEntry addOperation) {
STATE_UPDATER.set(this, State.ClosingLedger);
}
// interceptor entry before add to bookie
- if (beforeAddEntry(addOperation)) {
- addOperation.initiate();
- }
+ beforeAddEntry(addOperation).ifPresent(OpAddEntry::initiate);
}
}
- private boolean beforeAddEntry(OpAddEntry addOperation) {
+ private Optional<OpAddEntry> beforeAddEntry(OpAddEntry addOperation) {
// if no interceptor, just return true to make sure addOperation will
be initiate()
Review comment:
OK, but since this PR may not be merged because the BookKeeper side
could fix it. I may do this code refactor in another PR.
--
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]