hangc0276 commented on code in PR #17736:
URL: https://github.com/apache/pulsar/pull/17736#discussion_r976525563


##########
managed-ledger/src/main/java/org/apache/bookkeeper/mledger/impl/ManagedLedgerImpl.java:
##########
@@ -3842,12 +3868,21 @@ private void scheduleTimeoutTask() {
                     ? Math.max(config.getAddEntryTimeoutSeconds(), 
config.getReadEntryTimeoutSeconds())
                     : timeoutSec;
             this.timeoutTask = 
this.scheduledExecutor.scheduleAtFixedRate(safeRun(() -> {

Review Comment:
   Suggest change 
   ```
   safeRun(() -> {
                   checkTimeouts();
               })
   ```
   
   to `safeRun(this::checkTimeouts)`



##########
managed-ledger/src/main/java/org/apache/bookkeeper/mledger/impl/ManagedLedgerImpl.java:
##########
@@ -3639,6 +3664,7 @@ private void checkManagedLedgerIsOpen() throws 
ManagedLedgerException {
     }
 
     synchronized void setFenced() {
+        log.info("{} Moving to Fenced state", name);

Review Comment:
   Do we need to change the log level to `warn`?



##########
managed-ledger/src/main/java/org/apache/bookkeeper/mledger/impl/ManagedLedgerImpl.java:
##########
@@ -3842,12 +3868,21 @@ private void scheduleTimeoutTask() {
                     ? Math.max(config.getAddEntryTimeoutSeconds(), 
config.getReadEntryTimeoutSeconds())
                     : timeoutSec;
             this.timeoutTask = 
this.scheduledExecutor.scheduleAtFixedRate(safeRun(() -> {
-                checkAddTimeout();
-                checkReadTimeout();
+                checkTimeouts();
             }), timeoutSec, timeoutSec, TimeUnit.SECONDS);
         }
     }
 
+    private void checkTimeouts() {
+        final State state = STATE_UPDATER.get(this);
+        if (state == State.Closed
+                || state == State.Fenced) {
+            return;

Review Comment:
   Do we need to add a `warn` log?



-- 
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]

Reply via email to