YongGoose commented on code in PR #7349:
URL: https://github.com/apache/incubator-seata/pull/7349#discussion_r2095431735


##########
discovery/seata-discovery-etcd3/src/main/java/org/apache/seata/discovery/registry/etcd3/EtcdRegistryServiceImpl.java:
##########
@@ -178,7 +181,11 @@ public void unsubscribe(String cluster, Watch.Listener 
listener) throws Exceptio
                     .collect(Collectors.toSet());
             listenerMap.put(cluster, newSubscribeSet);
         }
-        watcherMap.remove(cluster).stop();
+
+        EtcdWatcher watcher = watcherMap.remove(cluster);
+        if (watcher != null) {
+            watcher.stop();

Review Comment:
   @funky-eyes 
   
   I added a null check here, so even if an element is not found in the map, it 
won't cause a `NullPointerException`.
   



-- 
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: notifications-unsubscr...@seata.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscr...@seata.apache.org
For additional commands, e-mail: notifications-h...@seata.apache.org

Reply via email to