baomingyu commented on a change in pull request #12223:
URL: https://github.com/apache/pulsar/pull/12223#discussion_r718360439
##########
File path:
managed-ledger/src/main/java/org/apache/bookkeeper/mledger/impl/ManagedLedgerImpl.java
##########
@@ -1592,10 +1592,21 @@ synchronized void ledgerClosed(final LedgerHandle lh) {
}
synchronized void createLedgerAfterClosed() {
- STATE_UPDATER.set(this, State.CreatingLedger);
- this.lastLedgerCreationInitiationTimestamp =
System.currentTimeMillis();
- mbean.startDataLedgerCreateOp();
- asyncCreateLedger(bookKeeper, config, digestType, this,
Collections.emptyMap());
+ if(isNeededCreateNewLedgerAfterCloseLedger()) {
+ log.info("[{}] Creating a new ledger after closed", name);
+ STATE_UPDATER.set(this, State.CreatingLedger);
+ this.lastLedgerCreationInitiationTimestamp =
System.currentTimeMillis();
+ mbean.startDataLedgerCreateOp();
+ asyncCreateLedger(bookKeeper, config, digestType, this,
Collections.emptyMap());
+ }
+ }
+
+ synchronized boolean isNeededCreateNewLedgerAfterCloseLedger() {
Review comment:
yes, now it is not neccessary to add synchronized before
isNeededCreateNewLedgerAfterCloseLedger method. and add synchronized now avoid
it is used by others.
--
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]