This is an automated email from the ASF dual-hosted git repository.

xiaoyu pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/shenyu.git


The following commit(s) were added to refs/heads/master by this push:
     new 04142f4bd [type:refactor] use MetaDataHandler replace 
MetaDataSubscriber (#3772)
04142f4bd is described below

commit 04142f4bdc55a3a9764106187ef981d094b2f13a
Author: dragon-zhang <[email protected]>
AuthorDate: Sat Jul 30 23:17:21 2022 +0800

    [type:refactor] use MetaDataHandler replace MetaDataSubscriber (#3772)
    
    * [type:refactor] use MetaDataHandler replace MetaDataSubscriber
    
    * fix test case
---
 .../DivideMetaDataHandler.java}                    | 34 +++++-----
 .../motan/handler/MotanMetaDataHandler.java}       | 44 ++++++++-----
 .../motan/subscriber/MotanMetaDataSubscriber.java  | 72 ---------------------
 .../SofaMetaDataHandler.java}                      | 47 +++++++-------
 .../plugin/tars/handler/TarsMetaDataHandler.java   | 73 ++++++++++++++++++++++
 .../tars/subscriber/TarsMetaDataSubscriber.java    | 72 ---------------------
 .../TarsMetaDataHandlerTest.java}                  | 16 ++---
 .../plugin/divide/DividePluginConfiguration.java   | 12 ++--
 .../divide/DividePluginConfigurationTest.java      | 10 +++
 .../plugin/motan/MotanPluginConfiguration.java     | 12 ++--
 .../plugin/motan/MotanPluginConfigurationTest.java |  8 +--
 .../plugin/sofa/SofaPluginConfiguration.java       | 12 ++--
 .../plugin/sofa/SofaPluginConfigurationTest.java   |  6 +-
 .../plugin/tars/TarsPluginConfiguration.java       | 12 ++--
 .../plugin/tars/TarsPluginConfigurationTest.java   |  8 +--
 15 files changed, 196 insertions(+), 242 deletions(-)

diff --git 
a/shenyu-plugin/shenyu-plugin-divide/src/main/java/org/apache/shenyu/plugin/divide/subscriber/DivideMetaDataSubscriber.java
 
b/shenyu-plugin/shenyu-plugin-divide/src/main/java/org/apache/shenyu/plugin/divide/handler/DivideMetaDataHandler.java
similarity index 59%
rename from 
shenyu-plugin/shenyu-plugin-divide/src/main/java/org/apache/shenyu/plugin/divide/subscriber/DivideMetaDataSubscriber.java
rename to 
shenyu-plugin/shenyu-plugin-divide/src/main/java/org/apache/shenyu/plugin/divide/handler/DivideMetaDataHandler.java
index 637f1508d..9b7755bdd 100644
--- 
a/shenyu-plugin/shenyu-plugin-divide/src/main/java/org/apache/shenyu/plugin/divide/subscriber/DivideMetaDataSubscriber.java
+++ 
b/shenyu-plugin/shenyu-plugin-divide/src/main/java/org/apache/shenyu/plugin/divide/handler/DivideMetaDataHandler.java
@@ -15,35 +15,37 @@
  * limitations under the License.
  */
 
-package org.apache.shenyu.plugin.divide.subscriber;
+package org.apache.shenyu.plugin.divide.handler;
 
 import org.apache.shenyu.common.dto.MetaData;
 import org.apache.shenyu.common.enums.RpcTypeEnum;
 import org.apache.shenyu.plugin.base.cache.MetaDataCache;
-import org.apache.shenyu.sync.data.api.MetaDataSubscriber;
+import org.apache.shenyu.plugin.base.handler.MetaDataHandler;
 
 /**
- * The type divide meta data subscriber.
+ * The type divide meta data handler.
  */
-public class DivideMetaDataSubscriber implements MetaDataSubscriber {
+public class DivideMetaDataHandler implements MetaDataHandler {
+    
     @Override
-    public void onSubscribe(final MetaData metaData) {
-        if (RpcTypeEnum.HTTP.getName().equals(metaData.getRpcType())) {
-            // the update is also need to clean, but there is no way to
-            // distinguish between crate and update, so it is always clean
-            MetaDataCache.getInstance().clean();
-        }
+    public void handle(final MetaData metaData) {
+        // the update is also need to clean, but there is no way to
+        // distinguish between crate and update, so it is always clean
+        MetaDataCache.getInstance().clean();
     }
-
+    
     @Override
-    public void unSubscribe(final MetaData metaData) {
-        if (RpcTypeEnum.HTTP.getName().equals(metaData.getRpcType())) {
-            MetaDataCache.getInstance().clean();
-        }
+    public void remove(final MetaData metaData) {
+        MetaDataCache.getInstance().clean();
     }
-
+    
     @Override
     public void refresh() {
         MetaDataCache.getInstance().clean();
     }
+    
+    @Override
+    public String rpcType() {
+        return RpcTypeEnum.HTTP.getName();
+    }
 }
diff --git 
a/shenyu-plugin/shenyu-plugin-sofa/src/main/java/org/apache/shenyu/plugin/sofa/subscriber/SofaMetaDataSubscriber.java
 
b/shenyu-plugin/shenyu-plugin-motan/src/main/java/org/apache/shenyu/plugin/motan/handler/MotanMetaDataHandler.java
similarity index 64%
copy from 
shenyu-plugin/shenyu-plugin-sofa/src/main/java/org/apache/shenyu/plugin/sofa/subscriber/SofaMetaDataSubscriber.java
copy to 
shenyu-plugin/shenyu-plugin-motan/src/main/java/org/apache/shenyu/plugin/motan/handler/MotanMetaDataHandler.java
index 3744e89f9..861527149 100644
--- 
a/shenyu-plugin/shenyu-plugin-sofa/src/main/java/org/apache/shenyu/plugin/sofa/subscriber/SofaMetaDataSubscriber.java
+++ 
b/shenyu-plugin/shenyu-plugin-motan/src/main/java/org/apache/shenyu/plugin/motan/handler/MotanMetaDataHandler.java
@@ -15,29 +15,36 @@
  * limitations under the License.
  */
 
-package org.apache.shenyu.plugin.sofa.subscriber;
+package org.apache.shenyu.plugin.motan.handler;
 
 import com.google.common.collect.Maps;
 import org.apache.shenyu.common.dto.MetaData;
 import org.apache.shenyu.common.enums.RpcTypeEnum;
-import org.apache.shenyu.plugin.sofa.cache.ApplicationConfigCache;
-import org.apache.shenyu.sync.data.api.MetaDataSubscriber;
+import org.apache.shenyu.plugin.base.handler.MetaDataHandler;
+import org.apache.shenyu.plugin.motan.cache.ApplicationConfigCache;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
 
 import java.util.Objects;
 import java.util.concurrent.ConcurrentMap;
 
 /**
- * The sofa metadata subscribe.
+ * The motan metadata handler.
  */
-public class SofaMetaDataSubscriber implements MetaDataSubscriber {
-
+public class MotanMetaDataHandler implements MetaDataHandler {
+    
+    /**
+     * logger.
+     */
+    private static final Logger LOG = 
LoggerFactory.getLogger(MotanMetaDataHandler.class);
+    
     private static final ConcurrentMap<String, MetaData> META_DATA = 
Maps.newConcurrentMap();
-
+    
     @Override
-    public void onSubscribe(final MetaData metaData) {
-        if (RpcTypeEnum.SOFA.getName().equals(metaData.getRpcType())) {
+    public void handle(final MetaData metaData) {
+        try {
             MetaData exist = META_DATA.get(metaData.getPath());
-            if (Objects.isNull(exist) || 
Objects.isNull(ApplicationConfigCache.getInstance().get(exist.getPath()).refer()))
 {
+            if (Objects.isNull(exist) || 
Objects.isNull(ApplicationConfigCache.getInstance().get(exist.getPath()).getRef()))
 {
                 // The first initialization
                 ApplicationConfigCache.getInstance().initRef(metaData);
             } else {
@@ -47,14 +54,19 @@ public class SofaMetaDataSubscriber implements 
MetaDataSubscriber {
                 }
             }
             META_DATA.put(metaData.getPath(), metaData);
+        } catch (Exception e) {
+            LOG.error("motan sync metadata is error [{}]", metaData, e);
         }
     }
-
+    
     @Override
-    public void unSubscribe(final MetaData metaData) {
-        if (RpcTypeEnum.SOFA.getName().equals(metaData.getRpcType())) {
-            
ApplicationConfigCache.getInstance().invalidate(metaData.getPath());
-            META_DATA.remove(metaData.getPath());
-        }
+    public void remove(final MetaData metaData) {
+        ApplicationConfigCache.getInstance().invalidate(metaData.getPath());
+        META_DATA.remove(metaData.getPath());
+    }
+    
+    @Override
+    public String rpcType() {
+        return RpcTypeEnum.MOTAN.getName();
     }
 }
diff --git 
a/shenyu-plugin/shenyu-plugin-motan/src/main/java/org/apache/shenyu/plugin/motan/subscriber/MotanMetaDataSubscriber.java
 
b/shenyu-plugin/shenyu-plugin-motan/src/main/java/org/apache/shenyu/plugin/motan/subscriber/MotanMetaDataSubscriber.java
deleted file mode 100644
index b2784649e..000000000
--- 
a/shenyu-plugin/shenyu-plugin-motan/src/main/java/org/apache/shenyu/plugin/motan/subscriber/MotanMetaDataSubscriber.java
+++ /dev/null
@@ -1,72 +0,0 @@
-/*
- * 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.shenyu.plugin.motan.subscriber;
-
-import com.google.common.collect.Maps;
-import org.apache.shenyu.common.dto.MetaData;
-import org.apache.shenyu.common.enums.RpcTypeEnum;
-import org.apache.shenyu.plugin.motan.cache.ApplicationConfigCache;
-import org.apache.shenyu.sync.data.api.MetaDataSubscriber;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import java.util.Objects;
-import java.util.concurrent.ConcurrentMap;
-
-/**
- * The motan metadata subscribe.
- */
-public class MotanMetaDataSubscriber implements MetaDataSubscriber {
-    
-    /**
-     * logger.
-     */
-    private static final Logger LOG = 
LoggerFactory.getLogger(MotanMetaDataSubscriber.class);
-    
-    private static final ConcurrentMap<String, MetaData> META_DATA = 
Maps.newConcurrentMap();
-    
-    @Override
-    public void onSubscribe(final MetaData metaData) {
-        try {
-            if (RpcTypeEnum.MOTAN.getName().equals(metaData.getRpcType())) {
-                MetaData exist = META_DATA.get(metaData.getPath());
-                if (Objects.isNull(exist) || 
Objects.isNull(ApplicationConfigCache.getInstance().get(exist.getPath()).getRef()))
 {
-                    // The first initialization
-                    ApplicationConfigCache.getInstance().initRef(metaData);
-                } else {
-                    if 
(!exist.getServiceName().equals(metaData.getServiceName()) || 
!exist.getRpcExt().equals(metaData.getRpcExt())) {
-                        // update
-                        ApplicationConfigCache.getInstance().build(metaData);
-                    }
-                }
-                META_DATA.put(metaData.getPath(), metaData);
-            }
-        } catch (Exception e) {
-            LOG.error("motan sync metadata is error [{}]", metaData, e);
-        }
-        
-    }
-    
-    @Override
-    public void unSubscribe(final MetaData metaData) {
-        if (RpcTypeEnum.MOTAN.getName().equals(metaData.getRpcType())) {
-            
ApplicationConfigCache.getInstance().invalidate(metaData.getPath());
-            META_DATA.remove(metaData.getPath());
-        }
-    }
-}
diff --git 
a/shenyu-plugin/shenyu-plugin-sofa/src/main/java/org/apache/shenyu/plugin/sofa/subscriber/SofaMetaDataSubscriber.java
 
b/shenyu-plugin/shenyu-plugin-sofa/src/main/java/org/apache/shenyu/plugin/sofa/handler/SofaMetaDataHandler.java
similarity index 50%
rename from 
shenyu-plugin/shenyu-plugin-sofa/src/main/java/org/apache/shenyu/plugin/sofa/subscriber/SofaMetaDataSubscriber.java
rename to 
shenyu-plugin/shenyu-plugin-sofa/src/main/java/org/apache/shenyu/plugin/sofa/handler/SofaMetaDataHandler.java
index 3744e89f9..200c8aad0 100644
--- 
a/shenyu-plugin/shenyu-plugin-sofa/src/main/java/org/apache/shenyu/plugin/sofa/subscriber/SofaMetaDataSubscriber.java
+++ 
b/shenyu-plugin/shenyu-plugin-sofa/src/main/java/org/apache/shenyu/plugin/sofa/handler/SofaMetaDataHandler.java
@@ -15,46 +15,47 @@
  * limitations under the License.
  */
 
-package org.apache.shenyu.plugin.sofa.subscriber;
+package org.apache.shenyu.plugin.sofa.handler;
 
 import com.google.common.collect.Maps;
 import org.apache.shenyu.common.dto.MetaData;
 import org.apache.shenyu.common.enums.RpcTypeEnum;
+import org.apache.shenyu.plugin.base.handler.MetaDataHandler;
 import org.apache.shenyu.plugin.sofa.cache.ApplicationConfigCache;
-import org.apache.shenyu.sync.data.api.MetaDataSubscriber;
 
 import java.util.Objects;
 import java.util.concurrent.ConcurrentMap;
 
 /**
- * The sofa metadata subscribe.
+ * The sofa metadata handler.
  */
-public class SofaMetaDataSubscriber implements MetaDataSubscriber {
+public class SofaMetaDataHandler implements MetaDataHandler {
 
     private static final ConcurrentMap<String, MetaData> META_DATA = 
Maps.newConcurrentMap();
-
+    
     @Override
-    public void onSubscribe(final MetaData metaData) {
-        if (RpcTypeEnum.SOFA.getName().equals(metaData.getRpcType())) {
-            MetaData exist = META_DATA.get(metaData.getPath());
-            if (Objects.isNull(exist) || 
Objects.isNull(ApplicationConfigCache.getInstance().get(exist.getPath()).refer()))
 {
-                // The first initialization
-                ApplicationConfigCache.getInstance().initRef(metaData);
-            } else {
-                if (!exist.getServiceName().equals(metaData.getServiceName()) 
|| !exist.getRpcExt().equals(metaData.getRpcExt())) {
-                    // update
-                    ApplicationConfigCache.getInstance().build(metaData);
-                }
+    public void handle(final MetaData metaData) {
+        MetaData exist = META_DATA.get(metaData.getPath());
+        if (Objects.isNull(exist) || 
Objects.isNull(ApplicationConfigCache.getInstance().get(exist.getPath()).refer()))
 {
+            // The first initialization
+            ApplicationConfigCache.getInstance().initRef(metaData);
+        } else {
+            if (!exist.getServiceName().equals(metaData.getServiceName()) || 
!exist.getRpcExt().equals(metaData.getRpcExt())) {
+                // update
+                ApplicationConfigCache.getInstance().build(metaData);
             }
-            META_DATA.put(metaData.getPath(), metaData);
         }
+        META_DATA.put(metaData.getPath(), metaData);
     }
-
+    
     @Override
-    public void unSubscribe(final MetaData metaData) {
-        if (RpcTypeEnum.SOFA.getName().equals(metaData.getRpcType())) {
-            
ApplicationConfigCache.getInstance().invalidate(metaData.getPath());
-            META_DATA.remove(metaData.getPath());
-        }
+    public void remove(final MetaData metaData) {
+        ApplicationConfigCache.getInstance().invalidate(metaData.getPath());
+        META_DATA.remove(metaData.getPath());
+    }
+    
+    @Override
+    public String rpcType() {
+        return RpcTypeEnum.SOFA.getName();
     }
 }
diff --git 
a/shenyu-plugin/shenyu-plugin-tars/src/main/java/org/apache/shenyu/plugin/tars/handler/TarsMetaDataHandler.java
 
b/shenyu-plugin/shenyu-plugin-tars/src/main/java/org/apache/shenyu/plugin/tars/handler/TarsMetaDataHandler.java
new file mode 100644
index 000000000..418e0f2c9
--- /dev/null
+++ 
b/shenyu-plugin/shenyu-plugin-tars/src/main/java/org/apache/shenyu/plugin/tars/handler/TarsMetaDataHandler.java
@@ -0,0 +1,73 @@
+/*
+ * 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.shenyu.plugin.tars.handler;
+
+import com.google.common.collect.Maps;
+import org.apache.commons.collections4.CollectionUtils;
+import org.apache.shenyu.common.dto.MetaData;
+import org.apache.shenyu.common.enums.RpcTypeEnum;
+import org.apache.shenyu.plugin.base.handler.MetaDataHandler;
+import org.apache.shenyu.plugin.tars.cache.ApplicationConfigCache;
+import org.apache.shenyu.plugin.tars.proxy.TarsInvokePrx;
+
+import java.util.List;
+import java.util.Objects;
+import java.util.concurrent.ConcurrentMap;
+import java.util.stream.Collectors;
+
+/**
+ * The tars metadata handler.
+ */
+public class TarsMetaDataHandler implements MetaDataHandler {
+
+    private static final ConcurrentMap<String, MetaData> META_DATA = 
Maps.newConcurrentMap();
+    
+    @Override
+    public void handle(final MetaData metaData) {
+        metaData.updateContextPath();
+        MetaData metaExist = META_DATA.get(metaData.getPath());
+        List<TarsInvokePrx> prxList = ApplicationConfigCache.getInstance()
+                .get(metaData.getPath()).getTarsInvokePrxList();
+        boolean exist = prxList.stream().anyMatch(tarsInvokePrx -> 
tarsInvokePrx.getHost().equals(metaData.getAppName()));
+        if (!exist) {
+            ApplicationConfigCache.getInstance().initPrx(metaData);
+        }
+        if (Objects.isNull(metaExist)) {
+            META_DATA.put(metaData.getPath(), metaData);
+        }
+    }
+    
+    @Override
+    public void remove(final MetaData metaData) {
+        metaData.updateContextPath();
+        List<TarsInvokePrx> prxList = ApplicationConfigCache.getInstance()
+                .get(metaData.getPath()).getTarsInvokePrxList();
+        List<TarsInvokePrx> removePrxList = prxList.stream()
+                .filter(tarsInvokePrx -> 
tarsInvokePrx.getHost().equals(metaData.getAppName()))
+                .collect(Collectors.toList());
+        prxList.removeAll(removePrxList);
+        if (CollectionUtils.isEmpty(prxList)) {
+            META_DATA.remove(metaData.getPath());
+        }
+    }
+    
+    @Override
+    public String rpcType() {
+        return RpcTypeEnum.TARS.getName();
+    }
+}
diff --git 
a/shenyu-plugin/shenyu-plugin-tars/src/main/java/org/apache/shenyu/plugin/tars/subscriber/TarsMetaDataSubscriber.java
 
b/shenyu-plugin/shenyu-plugin-tars/src/main/java/org/apache/shenyu/plugin/tars/subscriber/TarsMetaDataSubscriber.java
deleted file mode 100644
index 1f6522c60..000000000
--- 
a/shenyu-plugin/shenyu-plugin-tars/src/main/java/org/apache/shenyu/plugin/tars/subscriber/TarsMetaDataSubscriber.java
+++ /dev/null
@@ -1,72 +0,0 @@
-/*
- * 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.shenyu.plugin.tars.subscriber;
-
-import com.google.common.collect.Maps;
-import org.apache.commons.collections4.CollectionUtils;
-import org.apache.shenyu.common.dto.MetaData;
-import org.apache.shenyu.common.enums.RpcTypeEnum;
-import org.apache.shenyu.plugin.tars.cache.ApplicationConfigCache;
-import org.apache.shenyu.plugin.tars.proxy.TarsInvokePrx;
-import org.apache.shenyu.sync.data.api.MetaDataSubscriber;
-
-import java.util.List;
-import java.util.Objects;
-import java.util.concurrent.ConcurrentMap;
-import java.util.stream.Collectors;
-
-/**
- * The tars metadata subscribe.
- */
-public class TarsMetaDataSubscriber implements MetaDataSubscriber {
-
-    private static final ConcurrentMap<String, MetaData> META_DATA = 
Maps.newConcurrentMap();
-
-    @Override
-    public void onSubscribe(final MetaData metaData) {
-        metaData.updateContextPath();
-        if (Objects.equals(RpcTypeEnum.TARS.getName(), metaData.getRpcType())) 
{
-            MetaData metaExist = META_DATA.get(metaData.getPath());
-            List<TarsInvokePrx> prxList = ApplicationConfigCache.getInstance()
-                    .get(metaData.getPath()).getTarsInvokePrxList();
-            boolean exist = prxList.stream().anyMatch(tarsInvokePrx -> 
tarsInvokePrx.getHost().equals(metaData.getAppName()));
-            if (!exist) {
-                ApplicationConfigCache.getInstance().initPrx(metaData);
-            }
-            if (Objects.isNull(metaExist)) {
-                META_DATA.put(metaData.getPath(), metaData);
-            }
-        }
-    }
-
-    @Override
-    public void unSubscribe(final MetaData metaData) {
-        metaData.updateContextPath();
-        if (Objects.equals(RpcTypeEnum.TARS.getName(), metaData.getRpcType())) 
{
-            List<TarsInvokePrx> prxList = ApplicationConfigCache.getInstance()
-                    .get(metaData.getPath()).getTarsInvokePrxList();
-            List<TarsInvokePrx> removePrxList = prxList.stream()
-                    .filter(tarsInvokePrx -> 
tarsInvokePrx.getHost().equals(metaData.getAppName()))
-                    .collect(Collectors.toList());
-            prxList.removeAll(removePrxList);
-            if (CollectionUtils.isEmpty(prxList)) {
-                META_DATA.remove(metaData.getPath());
-            }
-        }
-    }
-}
diff --git 
a/shenyu-plugin/shenyu-plugin-tars/src/test/java/org/apache/shenyu/plugin/tars/subscriber/TarsMetaDataSubscriberTest.java
 
b/shenyu-plugin/shenyu-plugin-tars/src/test/java/org/apache/shenyu/plugin/tars/handler/TarsMetaDataHandlerTest.java
similarity index 80%
rename from 
shenyu-plugin/shenyu-plugin-tars/src/test/java/org/apache/shenyu/plugin/tars/subscriber/TarsMetaDataSubscriberTest.java
rename to 
shenyu-plugin/shenyu-plugin-tars/src/test/java/org/apache/shenyu/plugin/tars/handler/TarsMetaDataHandlerTest.java
index 77ae343b8..71eed8a4c 100644
--- 
a/shenyu-plugin/shenyu-plugin-tars/src/test/java/org/apache/shenyu/plugin/tars/subscriber/TarsMetaDataSubscriberTest.java
+++ 
b/shenyu-plugin/shenyu-plugin-tars/src/test/java/org/apache/shenyu/plugin/tars/handler/TarsMetaDataHandlerTest.java
@@ -15,7 +15,7 @@
  * limitations under the License.
  */
 
-package org.apache.shenyu.plugin.tars.subscriber;
+package org.apache.shenyu.plugin.tars.handler;
 
 import org.apache.shenyu.common.dto.MetaData;
 import org.apache.shenyu.common.enums.RpcTypeEnum;
@@ -25,12 +25,12 @@ import org.junit.jupiter.api.extension.ExtendWith;
 import org.mockito.junit.jupiter.MockitoExtension;
 
 /**
- * Test case for {@link TarsMetaDataSubscriber}.
+ * Test case for {@link 
org.apache.shenyu.plugin.tars.handler.TarsMetaDataHandler}.
  */
 @ExtendWith(MockitoExtension.class)
-public class TarsMetaDataSubscriberTest {
+public class TarsMetaDataHandlerTest {
 
-    private TarsMetaDataSubscriber tarsMetaDataSubscriber;
+    private TarsMetaDataHandler tarsMetaDataHandler;
 
     private MetaData metaData;
 
@@ -40,20 +40,20 @@ public class TarsMetaDataSubscriberTest {
                 "path", RpcTypeEnum.TARS.getName(), "serviceName", "method1",
                 "parameterTypes", 
"{\"methodInfo\":[{\"methodName\":\"method1\",\"params\":[{\"left\":\"int\",\"right\":\"param1\"},"
                 + 
"{\"left\":\"java.lang.Integer\",\"right\":\"param2\"}],\"returnType\":\"java.lang.String\"}]}",
 false);
-        tarsMetaDataSubscriber = new TarsMetaDataSubscriber();
+        tarsMetaDataHandler = new TarsMetaDataHandler();
     }
 
     @Test
     public void testOnSubscribe() {
-        tarsMetaDataSubscriber.onSubscribe(metaData);
+        tarsMetaDataHandler.handle(metaData);
         /**
          * test for cache;
          */
-        tarsMetaDataSubscriber.onSubscribe(metaData);
+        tarsMetaDataHandler.handle(metaData);
     }
 
     @Test
     public void testUnSubscribe() {
-        tarsMetaDataSubscriber.unSubscribe(metaData);
+        tarsMetaDataHandler.remove(metaData);
     }
 }
diff --git 
a/shenyu-spring-boot-starter/shenyu-spring-boot-starter-plugin/shenyu-spring-boot-starter-plugin-divide/src/main/java/org/apache/shenyu/springboot/plugin/divide/DividePluginConfiguration.java
 
b/shenyu-spring-boot-starter/shenyu-spring-boot-starter-plugin/shenyu-spring-boot-starter-plugin-divide/src/main/java/org/apache/shenyu/springboot/plugin/divide/DividePluginConfiguration.java
index 526db16b2..3b8f1d969 100644
--- 
a/shenyu-spring-boot-starter/shenyu-spring-boot-starter-plugin/shenyu-spring-boot-starter-plugin-divide/src/main/java/org/apache/shenyu/springboot/plugin/divide/DividePluginConfiguration.java
+++ 
b/shenyu-spring-boot-starter/shenyu-spring-boot-starter-plugin/shenyu-spring-boot-starter-plugin-divide/src/main/java/org/apache/shenyu/springboot/plugin/divide/DividePluginConfiguration.java
@@ -19,12 +19,12 @@ package org.apache.shenyu.springboot.plugin.divide;
 
 import org.apache.shenyu.plugin.api.ShenyuPlugin;
 import org.apache.shenyu.plugin.api.context.ShenyuContextDecorator;
+import org.apache.shenyu.plugin.base.handler.MetaDataHandler;
 import org.apache.shenyu.plugin.base.handler.PluginDataHandler;
 import org.apache.shenyu.plugin.divide.DividePlugin;
 import org.apache.shenyu.plugin.divide.context.DivideShenyuContextDecorator;
 import org.apache.shenyu.plugin.divide.handler.DividePluginDataHandler;
-import org.apache.shenyu.plugin.divide.subscriber.DivideMetaDataSubscriber;
-import org.apache.shenyu.sync.data.api.MetaDataSubscriber;
+import org.apache.shenyu.plugin.divide.handler.DivideMetaDataHandler;
 import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
 import org.springframework.context.annotation.Bean;
 import org.springframework.context.annotation.Configuration;
@@ -57,13 +57,13 @@ public class DividePluginConfiguration {
     }
 
     /**
-     * divide meta data subscriber.
+     * divide meta data handler.
      *
-     * @return the meta data subscriber
+     * @return the meta data handler
      */
     @Bean
-    public MetaDataSubscriber divideMetaDataSubscriber() {
-        return new DivideMetaDataSubscriber();
+    public MetaDataHandler divideMetaDataHandler() {
+        return new DivideMetaDataHandler();
     }
 
     /**
diff --git 
a/shenyu-spring-boot-starter/shenyu-spring-boot-starter-plugin/shenyu-spring-boot-starter-plugin-divide/src/test/java/org/apache/shenyu/springboot/plugin/divide/DividePluginConfigurationTest.java
 
b/shenyu-spring-boot-starter/shenyu-spring-boot-starter-plugin/shenyu-spring-boot-starter-plugin-divide/src/test/java/org/apache/shenyu/springboot/plugin/divide/DividePluginConfigurationTest.java
index f8cb97829..8c9462a8f 100644
--- 
a/shenyu-spring-boot-starter/shenyu-spring-boot-starter-plugin/shenyu-spring-boot-starter-plugin-divide/src/test/java/org/apache/shenyu/springboot/plugin/divide/DividePluginConfigurationTest.java
+++ 
b/shenyu-spring-boot-starter/shenyu-spring-boot-starter-plugin/shenyu-spring-boot-starter-plugin-divide/src/test/java/org/apache/shenyu/springboot/plugin/divide/DividePluginConfigurationTest.java
@@ -19,6 +19,7 @@ package org.apache.shenyu.springboot.plugin.divide;
 
 import org.apache.shenyu.plugin.api.ShenyuPlugin;
 import org.apache.shenyu.plugin.api.context.ShenyuContextDecorator;
+import org.apache.shenyu.plugin.base.handler.MetaDataHandler;
 import org.apache.shenyu.plugin.base.handler.PluginDataHandler;
 import org.junit.jupiter.api.BeforeEach;
 import org.junit.jupiter.api.Test;
@@ -63,6 +64,15 @@ public class DividePluginConfigurationTest {
             }
         );
     }
+    
+    @Test
+    public void testDivideMetaDataHandler() {
+        applicationContextRunner.run(context -> {
+                MetaDataHandler handler = 
context.getBean("divideMetaDataHandler", MetaDataHandler.class);
+                assertNotNull(handler);
+            }
+        );
+    }
 
     @Test
     public void testDivideShenyuContextDecorator() {
diff --git 
a/shenyu-spring-boot-starter/shenyu-spring-boot-starter-plugin/shenyu-spring-boot-starter-plugin-motan/src/main/java/org/apache/shenyu/springboot/starter/plugin/motan/MotanPluginConfiguration.java
 
b/shenyu-spring-boot-starter/shenyu-spring-boot-starter-plugin/shenyu-spring-boot-starter-plugin-motan/src/main/java/org/apache/shenyu/springboot/starter/plugin/motan/MotanPluginConfiguration.java
index 415db8877..cbac1185d 100644
--- 
a/shenyu-spring-boot-starter/shenyu-spring-boot-starter-plugin/shenyu-spring-boot-starter-plugin-motan/src/main/java/org/apache/shenyu/springboot/starter/plugin/motan/MotanPluginConfiguration.java
+++ 
b/shenyu-spring-boot-starter/shenyu-spring-boot-starter-plugin/shenyu-spring-boot-starter-plugin-motan/src/main/java/org/apache/shenyu/springboot/starter/plugin/motan/MotanPluginConfiguration.java
@@ -19,13 +19,13 @@ package org.apache.shenyu.springboot.starter.plugin.motan;
 
 import org.apache.shenyu.plugin.api.ShenyuPlugin;
 import org.apache.shenyu.plugin.api.context.ShenyuContextDecorator;
+import org.apache.shenyu.plugin.base.handler.MetaDataHandler;
 import org.apache.shenyu.plugin.base.handler.PluginDataHandler;
 import org.apache.shenyu.plugin.motan.MotanPlugin;
 import org.apache.shenyu.plugin.motan.context.MotanShenyuContextDecorator;
 import org.apache.shenyu.plugin.motan.handler.MotanPluginDataHandler;
 import org.apache.shenyu.plugin.motan.proxy.MotanProxyService;
-import org.apache.shenyu.plugin.motan.subscriber.MotanMetaDataSubscriber;
-import org.apache.shenyu.sync.data.api.MetaDataSubscriber;
+import org.apache.shenyu.plugin.motan.handler.MotanMetaDataHandler;
 import org.springframework.boot.autoconfigure.condition.ConditionalOnClass;
 import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
 import org.springframework.context.annotation.Bean;
@@ -71,13 +71,13 @@ public class MotanPluginConfiguration {
     }
 
     /**
-     * Motan meta data subscriber.
+     * Motan meta data handler.
      *
-     * @return the meta data subscriber
+     * @return the meta data handler
      */
     @Bean
-    public MetaDataSubscriber motanMetaDataSubscriber() {
-        return new MotanMetaDataSubscriber();
+    public MetaDataHandler motanMetaDataHandler() {
+        return new MotanMetaDataHandler();
     }
     
     /**
diff --git 
a/shenyu-spring-boot-starter/shenyu-spring-boot-starter-plugin/shenyu-spring-boot-starter-plugin-motan/src/test/java/org/apache/shenyu/springboot/starter/plugin/motan/MotanPluginConfigurationTest.java
 
b/shenyu-spring-boot-starter/shenyu-spring-boot-starter-plugin/shenyu-spring-boot-starter-plugin-motan/src/test/java/org/apache/shenyu/springboot/starter/plugin/motan/MotanPluginConfigurationTest.java
index a9e04b3a1..4665c36ce 100644
--- 
a/shenyu-spring-boot-starter/shenyu-spring-boot-starter-plugin/shenyu-spring-boot-starter-plugin-motan/src/test/java/org/apache/shenyu/springboot/starter/plugin/motan/MotanPluginConfigurationTest.java
+++ 
b/shenyu-spring-boot-starter/shenyu-spring-boot-starter-plugin/shenyu-spring-boot-starter-plugin-motan/src/test/java/org/apache/shenyu/springboot/starter/plugin/motan/MotanPluginConfigurationTest.java
@@ -18,9 +18,9 @@
 package org.apache.shenyu.springboot.starter.plugin.motan;
 
 import org.apache.shenyu.plugin.api.context.ShenyuContextDecorator;
+import org.apache.shenyu.plugin.base.handler.MetaDataHandler;
 import org.apache.shenyu.plugin.base.handler.PluginDataHandler;
 import org.apache.shenyu.plugin.motan.MotanPlugin;
-import org.apache.shenyu.sync.data.api.MetaDataSubscriber;
 import org.junit.jupiter.api.BeforeEach;
 import org.junit.jupiter.api.Test;
 import org.springframework.boot.autoconfigure.AutoConfigurations;
@@ -66,10 +66,10 @@ public class MotanPluginConfigurationTest {
     }
 
     @Test
-    public void testMotanMetaDataSubscriber() {
+    public void testMotanMetaDataHandler() {
         applicationContextRunner.run(context -> {
-                MetaDataSubscriber subscriber = 
context.getBean("motanMetaDataSubscriber", MetaDataSubscriber.class);
-                assertNotNull(subscriber);
+                MetaDataHandler handler = 
context.getBean("motanMetaDataHandler", MetaDataHandler.class);
+                assertNotNull(handler);
             }
         );
     }
diff --git 
a/shenyu-spring-boot-starter/shenyu-spring-boot-starter-plugin/shenyu-spring-boot-starter-plugin-sofa/src/main/java/org/apache/shenyu/springboot/starter/plugin/sofa/SofaPluginConfiguration.java
 
b/shenyu-spring-boot-starter/shenyu-spring-boot-starter-plugin/shenyu-spring-boot-starter-plugin-sofa/src/main/java/org/apache/shenyu/springboot/starter/plugin/sofa/SofaPluginConfiguration.java
index b2bd7d8d1..1e5006e22 100644
--- 
a/shenyu-spring-boot-starter/shenyu-spring-boot-starter-plugin/shenyu-spring-boot-starter-plugin-sofa/src/main/java/org/apache/shenyu/springboot/starter/plugin/sofa/SofaPluginConfiguration.java
+++ 
b/shenyu-spring-boot-starter/shenyu-spring-boot-starter-plugin/shenyu-spring-boot-starter-plugin-sofa/src/main/java/org/apache/shenyu/springboot/starter/plugin/sofa/SofaPluginConfiguration.java
@@ -19,6 +19,7 @@ package org.apache.shenyu.springboot.starter.plugin.sofa;
 
 import org.apache.shenyu.plugin.api.ShenyuPlugin;
 import org.apache.shenyu.plugin.api.context.ShenyuContextDecorator;
+import org.apache.shenyu.plugin.base.handler.MetaDataHandler;
 import org.apache.shenyu.plugin.base.handler.PluginDataHandler;
 import org.apache.shenyu.plugin.sofa.SofaPlugin;
 import org.apache.shenyu.plugin.sofa.context.SofaShenyuContextDecorator;
@@ -26,8 +27,7 @@ import 
org.apache.shenyu.plugin.sofa.handler.SofaPluginDataHandler;
 import org.apache.shenyu.plugin.sofa.param.SofaParamResolveService;
 import org.apache.shenyu.plugin.sofa.param.SofaParamResolveServiceImpl;
 import org.apache.shenyu.plugin.sofa.proxy.SofaProxyService;
-import org.apache.shenyu.plugin.sofa.subscriber.SofaMetaDataSubscriber;
-import org.apache.shenyu.sync.data.api.MetaDataSubscriber;
+import org.apache.shenyu.plugin.sofa.handler.SofaMetaDataHandler;
 import org.springframework.beans.factory.ObjectProvider;
 import org.springframework.boot.autoconfigure.condition.ConditionalOnClass;
 import 
org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
@@ -77,13 +77,13 @@ public class SofaPluginConfiguration {
     }
     
     /**
-     * Sofa meta data subscriber.
+     * Sofa meta data handler.
      *
-     * @return the meta data subscriber
+     * @return the meta data handler
      */
     @Bean
-    public MetaDataSubscriber sofaMetaDataSubscriber() {
-        return new SofaMetaDataSubscriber();
+    public MetaDataHandler sofaMetaDataHandler() {
+        return new SofaMetaDataHandler();
     }
     
     /**
diff --git 
a/shenyu-spring-boot-starter/shenyu-spring-boot-starter-plugin/shenyu-spring-boot-starter-plugin-sofa/src/test/java/org/apache/shenyu/springboot/starter/plugin/sofa/SofaPluginConfigurationTest.java
 
b/shenyu-spring-boot-starter/shenyu-spring-boot-starter-plugin/shenyu-spring-boot-starter-plugin-sofa/src/test/java/org/apache/shenyu/springboot/starter/plugin/sofa/SofaPluginConfigurationTest.java
index 3a0a30b64..f8f958cd3 100644
--- 
a/shenyu-spring-boot-starter/shenyu-spring-boot-starter-plugin/shenyu-spring-boot-starter-plugin-sofa/src/test/java/org/apache/shenyu/springboot/starter/plugin/sofa/SofaPluginConfigurationTest.java
+++ 
b/shenyu-spring-boot-starter/shenyu-spring-boot-starter-plugin/shenyu-spring-boot-starter-plugin-sofa/src/test/java/org/apache/shenyu/springboot/starter/plugin/sofa/SofaPluginConfigurationTest.java
@@ -20,9 +20,9 @@ package org.apache.shenyu.springboot.starter.plugin.sofa;
 import org.apache.shenyu.common.enums.PluginEnum;
 import org.apache.shenyu.plugin.api.ShenyuPlugin;
 import org.apache.shenyu.plugin.api.context.ShenyuContextDecorator;
+import org.apache.shenyu.plugin.base.handler.MetaDataHandler;
 import org.apache.shenyu.plugin.base.handler.PluginDataHandler;
 import org.apache.shenyu.plugin.sofa.param.SofaParamResolveService;
-import org.apache.shenyu.sync.data.api.MetaDataSubscriber;
 import org.junit.jupiter.api.BeforeEach;
 import org.junit.jupiter.api.Test;
 import org.springframework.boot.autoconfigure.AutoConfigurations;
@@ -81,8 +81,8 @@ public class SofaPluginConfigurationTest {
     @Test
     public void testSofaMetaDataSubscriber() {
         applicationContextRunner.run(context -> {
-                MetaDataSubscriber subscriber = 
context.getBean("sofaMetaDataSubscriber", MetaDataSubscriber.class);
-                assertNotNull(subscriber);
+                MetaDataHandler handler = 
context.getBean("sofaMetaDataHandler", MetaDataHandler.class);
+                assertNotNull(handler);
             }
         );
     }
diff --git 
a/shenyu-spring-boot-starter/shenyu-spring-boot-starter-plugin/shenyu-spring-boot-starter-plugin-tars/src/main/java/org/apache/shenyu/springboot/starter/plugin/tars/TarsPluginConfiguration.java
 
b/shenyu-spring-boot-starter/shenyu-spring-boot-starter-plugin/shenyu-spring-boot-starter-plugin-tars/src/main/java/org/apache/shenyu/springboot/starter/plugin/tars/TarsPluginConfiguration.java
index a7cc8ee16..0f4de58e4 100644
--- 
a/shenyu-spring-boot-starter/shenyu-spring-boot-starter-plugin/shenyu-spring-boot-starter-plugin-tars/src/main/java/org/apache/shenyu/springboot/starter/plugin/tars/TarsPluginConfiguration.java
+++ 
b/shenyu-spring-boot-starter/shenyu-spring-boot-starter-plugin/shenyu-spring-boot-starter-plugin-tars/src/main/java/org/apache/shenyu/springboot/starter/plugin/tars/TarsPluginConfiguration.java
@@ -19,12 +19,12 @@ package org.apache.shenyu.springboot.starter.plugin.tars;
 
 import org.apache.shenyu.plugin.api.ShenyuPlugin;
 import org.apache.shenyu.plugin.api.context.ShenyuContextDecorator;
+import org.apache.shenyu.plugin.base.handler.MetaDataHandler;
 import org.apache.shenyu.plugin.base.handler.PluginDataHandler;
 import org.apache.shenyu.plugin.tars.TarsPlugin;
 import org.apache.shenyu.plugin.tars.context.TarsShenyuContextDecorator;
 import org.apache.shenyu.plugin.tars.handler.TarsPluginDataHandler;
-import org.apache.shenyu.plugin.tars.subscriber.TarsMetaDataSubscriber;
-import org.apache.shenyu.sync.data.api.MetaDataSubscriber;
+import org.apache.shenyu.plugin.tars.handler.TarsMetaDataHandler;
 import org.springframework.boot.autoconfigure.condition.ConditionalOnClass;
 import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
 import org.springframework.context.annotation.Bean;
@@ -49,13 +49,13 @@ public class TarsPluginConfiguration {
     }
 
     /**
-     * Tars meta data subscriber.
+     * Tars meta data handler.
      *
-     * @return the meta data subscriber
+     * @return the meta data handler
      */
     @Bean
-    public MetaDataSubscriber tarsMetaDataSubscriber() {
-        return new TarsMetaDataSubscriber();
+    public MetaDataHandler tarsMetaDataHandler() {
+        return new TarsMetaDataHandler();
     }
 
     /**
diff --git 
a/shenyu-spring-boot-starter/shenyu-spring-boot-starter-plugin/shenyu-spring-boot-starter-plugin-tars/src/test/java/org/apache/shenyu/springboot/starter/plugin/tars/TarsPluginConfigurationTest.java
 
b/shenyu-spring-boot-starter/shenyu-spring-boot-starter-plugin/shenyu-spring-boot-starter-plugin-tars/src/test/java/org/apache/shenyu/springboot/starter/plugin/tars/TarsPluginConfigurationTest.java
index 4fdd75cbe..04889d56f 100644
--- 
a/shenyu-spring-boot-starter/shenyu-spring-boot-starter-plugin/shenyu-spring-boot-starter-plugin-tars/src/test/java/org/apache/shenyu/springboot/starter/plugin/tars/TarsPluginConfigurationTest.java
+++ 
b/shenyu-spring-boot-starter/shenyu-spring-boot-starter-plugin/shenyu-spring-boot-starter-plugin-tars/src/test/java/org/apache/shenyu/springboot/starter/plugin/tars/TarsPluginConfigurationTest.java
@@ -20,8 +20,8 @@ package org.apache.shenyu.springboot.starter.plugin.tars;
 import org.apache.shenyu.common.enums.PluginEnum;
 import org.apache.shenyu.plugin.api.ShenyuPlugin;
 import org.apache.shenyu.plugin.api.context.ShenyuContextDecorator;
+import org.apache.shenyu.plugin.base.handler.MetaDataHandler;
 import org.apache.shenyu.plugin.base.handler.PluginDataHandler;
-import org.apache.shenyu.sync.data.api.MetaDataSubscriber;
 import org.junit.jupiter.api.BeforeEach;
 import org.junit.jupiter.api.Test;
 import org.springframework.boot.autoconfigure.AutoConfigurations;
@@ -60,10 +60,10 @@ public class TarsPluginConfigurationTest {
     }
 
     @Test
-    public void testTarsMetaDataSubscriber() {
+    public void testTarsMetaDataHandler() {
         applicationContextRunner.run(context -> {
-                MetaDataSubscriber subscriber = 
context.getBean("tarsMetaDataSubscriber", MetaDataSubscriber.class);
-                assertNotNull(subscriber);
+                MetaDataHandler handler = 
context.getBean("tarsMetaDataHandler", MetaDataHandler.class);
+                assertNotNull(handler);
             }
         );
     }

Reply via email to