slievrly commented on code in PR #6420:
URL: https://github.com/apache/incubator-seata/pull/6420#discussion_r1527549315


##########
config/seata-config-core/src/main/java/org/apache/seata/config/CachedConfigurationChangeListener.java:
##########
@@ -0,0 +1,28 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.seata.config;
+
+public interface CachedConfigurationChangeListener extends 
ConfigurationChangeListener {
+
+    ConfigurationCache CONFIGURATION_CACHE = ConfigurationCache.getInstance();
+
+    @Override
+    default void afterEvent(ConfigurationChangeEvent event) {
+        ConfigurationChangeListener listener = 
(ConfigurationChangeListener)CONFIGURATION_CACHE;
+        listener.onProcessEvent(event);

Review Comment:
   > > Design should not be function-oriented but object-oriented; consider 
design from the perspective of interactive behavior, not at the level of 
assembling functions. If ConfigurationCache's before and after are defined to 
be triggered identically, a logical call stack would be: 
NacosConfiguration.addConfigListener -> event -> listener.beforeEvent -> 
listener.onChangeEvent -> listener.afterEvent (ConfigurationCache.beforeEvent 
-> ConfigurationCache.onChangeEvent -> ConfigurationCache.afterEvent)
   > 
   > 我是认为ConfigurationCache不需要再有beforeEvent的相关逻辑了,如果有的话我认为是否未来可能会出现套娃现象? I was 
thinking that ConfigurationCache doesn't need to have beforeEvent related logic 
anymore, and if it does do I think there might be nesting in the future?
   
   This is about extendable design; it's not about whether a feature exists or 
not. If it doesn't exist, you can maintain an empty implementation, and if 
there is predefined logic, you can add it as needed. I suggest that you should 
not judge the design solely based on current functionalities. For example, with 
cache, aspects like secret computing and storage are points that can be 
extended both before and after.



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


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to