mattisonchao commented on code in PR #21188:
URL: https://github.com/apache/pulsar/pull/21188#discussion_r1328033542


##########
pulsar-metadata/src/main/java/org/apache/pulsar/metadata/bookkeeper/PulsarLedgerUnderreplicationManager.java:
##########
@@ -232,18 +236,26 @@ private void handleNotification(Notification n) {
             synchronized (this) {
                 // Notify that there were some changes on the under-replicated 
z-nodes
                 notifyAll();
-
-                if (n.getType() == NotificationType.Deleted) {
-                    if (n.getPath().equals(basePath + '/' + 
BookKeeperConstants.DISABLE_NODE)) {
-                        log.info("LedgerReplication is enabled externally 
through MetadataStore, "
-                                + "since DISABLE_NODE ZNode is deleted");
-                        if (replicationEnabledListener != null) {
-                            replicationEnabledListener.operationComplete(0, 
null);
-                        }
-                    } else if 
(n.getPath().equals(lostBookieRecoveryDelayPath)) {
-                        if (lostBookieRecoveryDelayListener != null) {
-                            
lostBookieRecoveryDelayListener.operationComplete(0, null);
-                        }
+                if (lostBookieRecoveryDelayPath.equals(n.getPath())) {
+                    List<BookkeeperInternalCallbacks.GenericCallback<Void>> 
callbackList;
+                    synchronized (lostBookieRecoveryDelayCallbacks) {
+                        callbackList = new 
ArrayList<>(lostBookieRecoveryDelayCallbacks);
+                        lostBookieRecoveryDelayCallbacks.clear();
+                    }
+                    for (BookkeeperInternalCallbacks.GenericCallback<Void> 
callback : callbackList) {
+                        callback.operationComplete(0, null);
+                    }
+                }
+                if (replicationDisablePath.equals(n.getPath()) && n.getType() 
== NotificationType.Deleted) {
+                    log.info("LedgerReplication is enabled externally through 
MetadataStore, "
+                            + "since DISABLE_NODE ZNode is deleted");
+                    List<BookkeeperInternalCallbacks.GenericCallback<Void>> 
callbackList;

Review Comment:
   Making this value to be final would be good. :)



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