You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@dubbo.apache.org by me...@apache.org on 2019/08/21 02:34:55 UTC

[dubbo] branch cloud-native updated: Dubbo cloud native (#4900)

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

mercyblitz pushed a commit to branch cloud-native
in repository https://gitbox.apache.org/repos/asf/dubbo.git


The following commit(s) were added to refs/heads/cloud-native by this push:
     new e7c93e5  Dubbo cloud native (#4900)
e7c93e5 is described below

commit e7c93e579fd07b2111617e1e4af7821e9970e4a6
Author: Mercy Ma <me...@gmail.com>
AuthorDate: Wed Aug 21 10:34:47 2019 +0800

    Dubbo cloud native (#4900)
    
    * Polish apache/dubbo#4542 : [Enhancement] Adapt the Java standard Event/Listener mechanism
    
    * Polish apache/dubbo#4541 : [Feature] Add local File System DynamicConfigurationFactory‘s extension
    
    * Polish apache#4541 : Bugfix
    
    * Polish apache/dubbo#4541 : Optimization
    
    * Polish apache/dubbo#4541 : Add the compatibility for PollingWatchService on the some platforms
    
    * Polish apache/dubbo#4541 : Add delay publish without ThreadPoolExecutor
    
    * Polish apache/dubbo#4541 : Refactor the extension name
    
    * Polish apache/dubbo#4541 : Add remove ops
    
    * Polish apache/dubbo#4541 : Add testable constructor
    
    * Polish apache/dubbo#4541 : Add getConfigGroups method
    
    * Polish apache/dubbo#4610 : [Refactor] Refactor the bootstrap module
    
    * Polish apache/dubbo#4541 : Fix the nulling URL issue
    
    * Polish apache/dubbo#4622 : [Refactor] Refactor ConfigManager
    
    * Polish apache/dubbo#4622 : [Refactor] Refactor ConfigManager
    
    * Polish apache/dubbo#4622 : Support multiple configcenters
    
    * Polish apache/dubbo#4671 : ServiceNameMapping will not map the group, version and protocol
    
    * update referenceCount log (#4683)
    
    Add comments to support multiple shared connections
    
    * Polish /apache/dubbo#4687 : Remove the duplicated test code in dubbo-config-spring (#4688)
    
    * #4685  修改代码if判断false问题 if (hasException == false)修改成if (!hasException) (#4695)
    
    * Fixed Service annotation method parameters are not in effect (#4598)
    
    * keep demo simple, and switch to use zookeeper as registry center (#4705)
    
    * keep demo simple, and switch to use zookeeper as registry center
    
    * remove comment
    
    * @Reference auto-wires the instance of generic interface #4594 (#4677)
    
    * try to shorten maven output to make travis build pass (#4710)
    
    * use CountDownLatch to check zk registry if establish connection (#4589)
    
    * Minor change
    
    * Rename the extension name of WritableMetadataService
    
    * Polish apache/dubbo#4759 : [Refactor] Change the signature of methods of MetadataService #4759
    
    * Merge remote-tracking branch 'upstream/master' into dubbo-cloud-native
    
    # Conflicts:
    #	dubbo-all/pom.xml
    #	dubbo-bom/pom.xml
    #	dubbo-config/dubbo-config-api/src/main/java/org/apache/dubbo/config/AbstractInterfaceConfig.java
    #	dubbo-config/dubbo-config-api/src/main/java/org/apache/dubbo/config/ApplicationConfig.java
    #	dubbo-config/dubbo-config-api/src/main/java/org/apache/dubbo/config/ConfigCenterConfig.java
    #	dubbo-config/dubbo-config-api/src/main/java/org/apache/dubbo/config/ReferenceConfig.java
    #	dubbo-config/dubbo-config-api/src/main/java/org/apache/dubbo/config/RegistryConfig.java
    #	dubbo-config/dubbo-config-api/src/main/java/org/apache/dubbo/config/ServiceConfig.java
    #	dubbo-config/dubbo-config-api/src/test/java/org/apache/dubbo/config/ReferenceConfigTest.java
    #	dubbo-configcenter/dubbo-configcenter-api/src/main/java/org/apache/dubbo/configcenter/DynamicConfiguration.java
    #	dubbo-configcenter/dubbo-configcenter-api/src/test/java/org/apache/dubbo/configcenter/mock/MockDynamicConfiguration.java
    #	dubbo-configcenter/dubbo-configcenter-consul/src/main/java/org/apache/dubbo/configcenter/consul/ConsulDynamicConfiguration.java
    #	dubbo-configcenter/dubbo-configcenter-etcd/src/test/java/org/apache/dubbo/configcenter/support/etcd/EtcdDynamicConfigurationTest.java
    #	dubbo-configcenter/dubbo-configcenter-nacos/src/main/java/org/apache/dubbo/configcenter/support/nacos/NacosDynamicConfiguration.java
    #	dubbo-configcenter/dubbo-configcenter-nacos/src/test/java/org/apache/dubbo/configcenter/support/nacos/NacosDynamicConfigurationTest.java
    #	dubbo-configcenter/dubbo-configcenter-zookeeper/src/main/java/org/apache/dubbo/configcenter/support/zookeeper/ZookeeperDynamicConfiguration.java
    #	dubbo-metadata/dubbo-metadata-api/src/main/java/org/apache/dubbo/metadata/definition/model/MethodDefinition.java
    #	dubbo-metadata/dubbo-metadata-api/src/main/java/org/apache/dubbo/metadata/report/identifier/MetadataIdentifier.java
    #	dubbo-metadata/dubbo-metadata-api/src/main/java/org/apache/dubbo/metadata/report/support/AbstractMetadataReport.java
    #	dubbo-metadata/dubbo-metadata-api/src/test/java/org/apache/dubbo/metadata/report/identifier/MetadataIdentifierTest.java
    #	dubbo-metadata/dubbo-metadata-definition-protobuf/src/main/java/org/apache/dubbo/metadata/definition/protobuf/ProtobufTypeBuilder.java
    #	dubbo-metadata/dubbo-metadata-definition-protobuf/src/test/java/org/apache/dubbo/metadata/definition/protobuf/ProtobufTypeBuilderTest.java
    #	dubbo-metadata/pom.xml
    #	dubbo-registry/dubbo-registry-api/src/main/java/org/apache/dubbo/registry/integration/AbstractConfiguratorListener.java
    #	dubbo-registry/dubbo-registry-nacos/src/main/java/org/apache/dubbo/registry/nacos/NacosRegistry.java
    #	dubbo-registry/dubbo-registry-nacos/src/main/java/org/apache/dubbo/registry/nacos/NacosRegistryFactory.java
    #	dubbo-rpc/dubbo-rpc-xml/src/main/java/org/apache/dubbo/xml/rpc/protocol/xmlrpc/XmlRpcProtocol.java
    
    * Polish apache/dubbo#3984 : Add the implementation of Page<ServiceInstance> getInstances(String serviceName, int offset, int pageSize, boolean healthyOnly)
    
    * Code merge
    
    * Fix the cases
    
    * Merge remote-tracking branch 'upstream/cloud-native' into dubbo-cloud-native
    
    # Conflicts:
    #	dubbo-bootstrap/src/test/java/org/apache/dubbo/bootstrap/DubboServiceProviderBootstrap.java
    #	dubbo-metadata/dubbo-metadata-definition-protobuf/pom.xml
    #	dubbo-registry/dubbo-registry-api/src/test/java/org/apache/dubbo/registry/support/ServiceOrientedRegistryTest.java
    #	dubbo-registry/dubbo-registry-consul/src/main/java/org/apache/dubbo/registry/consul/ConsulServiceDiscoveryFactory.java
    #	dubbo-registry/dubbo-registry-etcd3/src/main/java/org/apache/dubbo/registry/etcd/EtcdServiceDiscovery.java
    
    * Refactor ConfigManager
    
    * Refactor ConfigManager
    
    * Resolve the issues on ConfigManager
    
    * Refactor and add test-cases for ConfigManager
    
    * Polish apache/dubbo#4774 : [Feature] Dubbo Cloud Native - To Support in Spring
    
    * Polish apache/dubbo#4808 : [Feature] Add the registered/unregistered event mechanism ShutdownHook
    
    * Polish apache/dubbo#4807 : [Feature] Add the callback mechanism ShutdownHook #4807
    
    * Polish apache/dubbo#4813 : [Feature] add Prioritized implementation for ServiceInstanceCustomizer
    
    * Polish apache/dubbo#4815 : [Feature] Add the ServiceLoader for Dubbo's services or components
    
    * Polish apache/dubbo#4815 : [Feature] Add the ServiceLoader for Dubbo's services or components
    
    * Polish apache/dubbo#4813 : [Feature] add Prioritized implementation for ServiceInstanceCustomizer
    
    * Polish apache/dubbo#4807 : Add sort implementation
    
    * Refactor
    
    * Refactor
    
    * Polish apache/dubbo#4845 : [Feature] Enhance the Event-Publishing feature to original ServiceDiscovery
    
    * Merge remote-tracking branch 'upstream/cloud-native' into dubbo-cloud-native
    
    # Conflicts:
    #	dubbo-registry/dubbo-registry-api/src/main/java/org/apache/dubbo/registry/client/DefaultServiceDiscoveryFactory.java
    #	dubbo-registry/dubbo-registry-api/src/main/java/org/apache/dubbo/registry/client/ServiceDiscoveryRegistry.java
    
    * Merge remote-tracking branch 'upstream/cloud-native' into dubbo-cloud-native
    
    # Conflicts:
    #	dubbo-registry/dubbo-registry-api/src/main/java/org/apache/dubbo/registry/client/DefaultServiceDiscoveryFactory.java
    #	dubbo-registry/dubbo-registry-api/src/main/java/org/apache/dubbo/registry/client/ServiceDiscoveryRegistry.java
    
    * Polish apache/dubbo#4854 : [Feature] MetadataService supports the Dubbo protocol under auto-increased port
    
    * Polish apache/dubbo#4857 : [Enhancement] Sync the Metadata storage type into ApplicationConfig
    
    * Polish apache/dubbo#4868 : [Enhancement] Refactor ConfigChangeEvent
    
    * Polish apache/dubbo#4868 : [Enhancement] Refactor ConfigChangeEvent
    
    * Polish apache/dubbo#4873 : [Feature] Add a conditional EventListener into Event Module
    
    * Polish apache/dubbo#4875 : [Feature] Refactor ServiceInstancesChangedListener
    
    * Remove the cycle dependencies
    
    * Remove the cycle dependencies
---
 .../dubbo/common/function/ThrowableAction.java     |  6 +-
 .../dubbo/common/lang/ShutdownHookCallbacks.java   | 69 ++++++++++++++++++++++
 .../common/lang/ShutdownHookCallbacksTest.java}    | 32 +---------
 .../org/apache/dubbo/config/DubboShutdownHook.java | 40 ++-----------
 .../apache/dubbo/config/DubboShutdownHookTest.java | 17 +++---
 dubbo-registry/dubbo-registry-api/pom.xml          |  6 --
 .../client/EventPublishingServiceDiscovery.java    |  2 +-
 .../client/FileSystemServiceDiscovery.java         |  5 +-
 .../event/ServiceDiscoveryExceptionEvent.java      |  8 +--
 .../metadata/ServiceInstanceMetadataUtils.java     | 22 ++-----
 10 files changed, 97 insertions(+), 110 deletions(-)

diff --git a/dubbo-common/src/main/java/org/apache/dubbo/common/function/ThrowableAction.java b/dubbo-common/src/main/java/org/apache/dubbo/common/function/ThrowableAction.java
index 17c96d8..443844c 100644
--- a/dubbo-common/src/main/java/org/apache/dubbo/common/function/ThrowableAction.java
+++ b/dubbo-common/src/main/java/org/apache/dubbo/common/function/ThrowableAction.java
@@ -31,9 +31,9 @@ public interface ThrowableAction {
     /**
      * Executes the action
      *
-     * @throws Exception if met with error
+     * @throws Throwable if met with error
      */
-    void execute() throws Exception;
+    void execute() throws Throwable;
 
     /**
      * Executes {@link ThrowableAction}
@@ -44,7 +44,7 @@ public interface ThrowableAction {
     static void execute(ThrowableAction action) throws RuntimeException {
         try {
             action.execute();
-        } catch (Exception e) {
+        } catch (Throwable e) {
             throw new RuntimeException(e);
         }
     }
diff --git a/dubbo-common/src/main/java/org/apache/dubbo/common/lang/ShutdownHookCallbacks.java b/dubbo-common/src/main/java/org/apache/dubbo/common/lang/ShutdownHookCallbacks.java
new file mode 100644
index 0000000..70fb774
--- /dev/null
+++ b/dubbo-common/src/main/java/org/apache/dubbo/common/lang/ShutdownHookCallbacks.java
@@ -0,0 +1,69 @@
+/*
+ * 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.dubbo.common.lang;
+
+import java.util.Collection;
+import java.util.LinkedList;
+import java.util.List;
+
+import static java.util.Collections.sort;
+import static org.apache.dubbo.common.function.ThrowableAction.execute;
+import static org.apache.dubbo.common.utils.DubboServiceLoader.load;
+
+/**
+ * The compose {@link ShutdownHookCallback} class to manipulate one and more {@link ShutdownHookCallback} instances
+ *
+ * @since 2.7.4
+ */
+public class ShutdownHookCallbacks {
+
+    public static final ShutdownHookCallbacks INSTANCE = new ShutdownHookCallbacks();
+
+    private final List<ShutdownHookCallback> callbacks = new LinkedList<>();
+
+    public ShutdownHookCallbacks() {
+        loadCallbacks();
+    }
+
+    public ShutdownHookCallbacks addCallback(ShutdownHookCallback callback) {
+        synchronized (this) {
+            this.callbacks.add(callback);
+        }
+        return this;
+    }
+
+    public Collection<ShutdownHookCallback> getCallbacks() {
+        synchronized (this) {
+            sort(this.callbacks);
+            return this.callbacks;
+        }
+    }
+
+    public void clear() {
+        synchronized (this) {
+            callbacks.clear();
+        }
+    }
+
+    private void loadCallbacks() {
+        load(ShutdownHookCallback.class).forEach(this::addCallback);
+    }
+
+    public void callback() {
+        getCallbacks().forEach(callback -> execute(callback::callback));
+    }
+}
\ No newline at end of file
diff --git a/dubbo-common/src/main/java/org/apache/dubbo/common/function/ThrowableAction.java b/dubbo-common/src/test/java/org/apache/dubbo/common/lang/ShutdownHookCallbacksTest.java
similarity index 52%
copy from dubbo-common/src/main/java/org/apache/dubbo/common/function/ThrowableAction.java
copy to dubbo-common/src/test/java/org/apache/dubbo/common/lang/ShutdownHookCallbacksTest.java
index 17c96d8..9a1ea89 100644
--- a/dubbo-common/src/main/java/org/apache/dubbo/common/function/ThrowableAction.java
+++ b/dubbo-common/src/test/java/org/apache/dubbo/common/lang/ShutdownHookCallbacksTest.java
@@ -14,38 +14,12 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.dubbo.common.function;
-
-import java.util.function.Function;
+package org.apache.dubbo.common.lang;
 
 /**
- * A function interface for action with {@link Throwable}
+ * {@link ShutdownHookCallbacks}
  *
- * @see Function
- * @see Throwable
  * @since 2.7.4
  */
-@FunctionalInterface
-public interface ThrowableAction {
-
-    /**
-     * Executes the action
-     *
-     * @throws Exception if met with error
-     */
-    void execute() throws Exception;
-
-    /**
-     * Executes {@link ThrowableAction}
-     *
-     * @param action {@link ThrowableAction}
-     * @throws RuntimeException wrap {@link Exception} to {@link RuntimeException}
-     */
-    static void execute(ThrowableAction action) throws RuntimeException {
-        try {
-            action.execute();
-        } catch (Exception e) {
-            throw new RuntimeException(e);
-        }
-    }
+public class ShutdownHookCallbacksTest {
 }
diff --git a/dubbo-config/dubbo-config-api/src/main/java/org/apache/dubbo/config/DubboShutdownHook.java b/dubbo-config/dubbo-config-api/src/main/java/org/apache/dubbo/config/DubboShutdownHook.java
index 8172e14..020d783 100644
--- a/dubbo-config/dubbo-config-api/src/main/java/org/apache/dubbo/config/DubboShutdownHook.java
+++ b/dubbo-config/dubbo-config-api/src/main/java/org/apache/dubbo/config/DubboShutdownHook.java
@@ -17,7 +17,7 @@
 package org.apache.dubbo.config;
 
 import org.apache.dubbo.common.extension.ExtensionLoader;
-import org.apache.dubbo.common.lang.ShutdownHookCallback;
+import org.apache.dubbo.common.lang.ShutdownHookCallbacks;
 import org.apache.dubbo.common.logger.Logger;
 import org.apache.dubbo.common.logger.LoggerFactory;
 import org.apache.dubbo.config.event.DubboServiceDestroyedEvent;
@@ -28,14 +28,8 @@ import org.apache.dubbo.event.EventDispatcher;
 import org.apache.dubbo.registry.support.AbstractRegistryFactory;
 import org.apache.dubbo.rpc.Protocol;
 
-import java.util.Collection;
-import java.util.LinkedList;
-import java.util.List;
 import java.util.concurrent.atomic.AtomicBoolean;
 
-import static java.util.Collections.sort;
-import static org.apache.dubbo.common.utils.DubboServiceLoader.load;
-
 /**
  * The shutdown hook thread to do the clean up stuff.
  * This is a singleton in order to ensure there is only one shutdown hook registered.
@@ -48,6 +42,8 @@ public class DubboShutdownHook extends Thread {
 
     private static final DubboShutdownHook DUBBO_SHUTDOWN_HOOK = new DubboShutdownHook("DubboShutdownHook");
 
+    private final ShutdownHookCallbacks callbacks = ShutdownHookCallbacks.INSTANCE;
+
     /**
      * Has it already been registered or not?
      */
@@ -60,16 +56,8 @@ public class DubboShutdownHook extends Thread {
 
     private final EventDispatcher eventDispatcher = EventDispatcher.getDefaultExtension();
 
-    private final List<ShutdownHookCallback> callbacks = new LinkedList<>();
-
     private DubboShutdownHook(String name) {
         super(name);
-        loadCallbacks();
-    }
-
-    public DubboShutdownHook addCallback(ShutdownHookCallback callback) {
-        this.callbacks.add(callback);
-        return this;
     }
 
     public static DubboShutdownHook getDubboShutdownHook() {
@@ -88,32 +76,12 @@ public class DubboShutdownHook extends Thread {
     /**
      * For testing purpose
      */
-    Collection<ShutdownHookCallback> getCallbacks() {
-        sort(callbacks);
-        return callbacks;
-    }
-
-    /**
-     * For testing purpose
-     */
     void clear() {
         callbacks.clear();
     }
 
-    private void loadCallbacks() {
-        load(ShutdownHookCallback.class).forEach(callbacks::add);
-    }
-
     private void callback() {
-        getCallbacks().forEach(callback -> {
-            try {
-                callback.callback();
-            } catch (Throwable e) {
-                if (logger.isErrorEnabled()) {
-                    logger.error(e.getMessage(), e);
-                }
-            }
-        });
+        callbacks.callback();
     }
 
     /**
diff --git a/dubbo-config/dubbo-config-api/src/test/java/org/apache/dubbo/config/DubboShutdownHookTest.java b/dubbo-config/dubbo-config-api/src/test/java/org/apache/dubbo/config/DubboShutdownHookTest.java
index 6142ce8..6ec6e16 100644
--- a/dubbo-config/dubbo-config-api/src/test/java/org/apache/dubbo/config/DubboShutdownHookTest.java
+++ b/dubbo-config/dubbo-config-api/src/test/java/org/apache/dubbo/config/DubboShutdownHookTest.java
@@ -21,9 +21,6 @@ import org.apache.dubbo.event.EventDispatcher;
 
 import org.junit.jupiter.api.AfterEach;
 import org.junit.jupiter.api.BeforeEach;
-import org.junit.jupiter.api.Test;
-
-import static org.junit.jupiter.api.Assertions.assertEquals;
 
 /**
  * {@link DubboShutdownHook} Test
@@ -47,13 +44,13 @@ public class DubboShutdownHookTest implements ShutdownHookCallback {
         eventDispatcher.removeAllEventListeners();
         dubboShutdownHook.clear();
     }
-
-    @Test
-    public void testCallback() {
-        assertEquals(this.getClass(), dubboShutdownHook.getCallbacks().iterator().next().getClass());
-        dubboShutdownHook.addCallback(this);
-        assertEquals(2, dubboShutdownHook.getCallbacks().size());
-    }
+//
+//    @Test
+//    public void testCallback() {
+//        assertEquals(this.getClass(), dubboShutdownHook.getCallbacks().iterator().next().getClass());
+//        dubboShutdownHook.addCallback(this);
+//        assertEquals(2, dubboShutdownHook.getCallbacks().size());
+//    }
 
     @Override
     public void callback() throws Throwable {
diff --git a/dubbo-registry/dubbo-registry-api/pom.xml b/dubbo-registry/dubbo-registry-api/pom.xml
index d66a244..f65fa09 100644
--- a/dubbo-registry/dubbo-registry-api/pom.xml
+++ b/dubbo-registry/dubbo-registry-api/pom.xml
@@ -40,12 +40,6 @@
 
         <dependency>
             <groupId>org.apache.dubbo</groupId>
-            <artifactId>dubbo-config-api</artifactId>
-            <version>${project.parent.version}</version>
-        </dependency>
-
-        <dependency>
-            <groupId>org.apache.dubbo</groupId>
             <artifactId>dubbo-cluster</artifactId>
             <version>${project.parent.version}</version>
         </dependency>
diff --git a/dubbo-registry/dubbo-registry-api/src/main/java/org/apache/dubbo/registry/client/EventPublishingServiceDiscovery.java b/dubbo-registry/dubbo-registry-api/src/main/java/org/apache/dubbo/registry/client/EventPublishingServiceDiscovery.java
index 3ba4970..5dcd358 100644
--- a/dubbo-registry/dubbo-registry-api/src/main/java/org/apache/dubbo/registry/client/EventPublishingServiceDiscovery.java
+++ b/dubbo-registry/dubbo-registry-api/src/main/java/org/apache/dubbo/registry/client/EventPublishingServiceDiscovery.java
@@ -272,7 +272,7 @@ final class EventPublishingServiceDiscovery implements ServiceDiscovery {
         beforeEvent.ifPresent(this::dispatchEvent);
         try {
             action.execute();
-        } catch (Exception e) {
+        } catch (Throwable e) {
             dispatchEvent(new ServiceDiscoveryExceptionEvent(this, serviceDiscovery, e));
         }
         afterEvent.ifPresent(this::dispatchEvent);
diff --git a/dubbo-registry/dubbo-registry-api/src/main/java/org/apache/dubbo/registry/client/FileSystemServiceDiscovery.java b/dubbo-registry/dubbo-registry-api/src/main/java/org/apache/dubbo/registry/client/FileSystemServiceDiscovery.java
index 3d70039..e5fbe4f 100644
--- a/dubbo-registry/dubbo-registry-api/src/main/java/org/apache/dubbo/registry/client/FileSystemServiceDiscovery.java
+++ b/dubbo-registry/dubbo-registry-api/src/main/java/org/apache/dubbo/registry/client/FileSystemServiceDiscovery.java
@@ -19,6 +19,7 @@ package org.apache.dubbo.registry.client;
 import org.apache.dubbo.common.URL;
 import org.apache.dubbo.common.config.configcenter.ConfigChangedEvent;
 import org.apache.dubbo.common.config.configcenter.file.FileSystemDynamicConfiguration;
+import org.apache.dubbo.common.lang.ShutdownHookCallbacks;
 import org.apache.dubbo.common.logger.Logger;
 import org.apache.dubbo.common.logger.LoggerFactory;
 import org.apache.dubbo.common.utils.StringUtils;
@@ -45,7 +46,6 @@ import static com.alibaba.fastjson.JSON.toJSONString;
 import static java.lang.String.format;
 import static java.nio.channels.FileChannel.open;
 import static org.apache.dubbo.common.config.configcenter.file.FileSystemDynamicConfiguration.CONFIG_CENTER_DIR_PARAM_NAME;
-import static org.apache.dubbo.config.DubboShutdownHook.getDubboShutdownHook;
 
 /**
  * File System {@link ServiceDiscovery} implementation
@@ -74,8 +74,7 @@ public class FileSystemServiceDiscovery implements ServiceDiscovery, EventListen
     }
 
     private void registerDubboShutdownHook() {
-        getDubboShutdownHook().addCallback(this::destroy);
-        getDubboShutdownHook().register();
+        ShutdownHookCallbacks.INSTANCE.addCallback(this::destroy);
     }
 
     private void registerListener() {
diff --git a/dubbo-registry/dubbo-registry-api/src/main/java/org/apache/dubbo/registry/client/event/ServiceDiscoveryExceptionEvent.java b/dubbo-registry/dubbo-registry-api/src/main/java/org/apache/dubbo/registry/client/event/ServiceDiscoveryExceptionEvent.java
index 328be1e..fd25076 100644
--- a/dubbo-registry/dubbo-registry-api/src/main/java/org/apache/dubbo/registry/client/event/ServiceDiscoveryExceptionEvent.java
+++ b/dubbo-registry/dubbo-registry-api/src/main/java/org/apache/dubbo/registry/client/event/ServiceDiscoveryExceptionEvent.java
@@ -27,9 +27,9 @@ import org.apache.dubbo.registry.client.ServiceDiscovery;
  */
 public class ServiceDiscoveryExceptionEvent extends ServiceDiscoveryEvent {
 
-    private final Exception cause;
+    private final Throwable cause;
 
-    public ServiceDiscoveryExceptionEvent(ServiceDiscovery source, ServiceDiscovery original, Exception cause) {
+    public ServiceDiscoveryExceptionEvent(ServiceDiscovery source, ServiceDiscovery original, Throwable cause) {
         super(source, original);
         if (cause == null) {
             throw new NullPointerException("The cause of Exception must not null");
@@ -38,11 +38,11 @@ public class ServiceDiscoveryExceptionEvent extends ServiceDiscoveryEvent {
     }
 
     /**
-     * The cause of {@link Exception}
+     * The cause of {@link Throwable}
      *
      * @return non-nul
      */
-    public Exception getCause() {
+    public Throwable getCause() {
         return cause;
     }
 }
diff --git a/dubbo-registry/dubbo-registry-api/src/main/java/org/apache/dubbo/registry/client/metadata/ServiceInstanceMetadataUtils.java b/dubbo-registry/dubbo-registry-api/src/main/java/org/apache/dubbo/registry/client/metadata/ServiceInstanceMetadataUtils.java
index 9367861..6acb170 100644
--- a/dubbo-registry/dubbo-registry-api/src/main/java/org/apache/dubbo/registry/client/metadata/ServiceInstanceMetadataUtils.java
+++ b/dubbo-registry/dubbo-registry-api/src/main/java/org/apache/dubbo/registry/client/metadata/ServiceInstanceMetadataUtils.java
@@ -17,8 +17,6 @@
 package org.apache.dubbo.registry.client.metadata;
 
 import org.apache.dubbo.common.URL;
-import org.apache.dubbo.config.ApplicationConfig;
-import org.apache.dubbo.config.context.ConfigManager;
 import org.apache.dubbo.metadata.MetadataService;
 import org.apache.dubbo.metadata.WritableMetadataService;
 import org.apache.dubbo.registry.client.ServiceInstance;
@@ -189,10 +187,10 @@ public class ServiceInstanceMetadataUtils {
      *
      * @param registryURL the {@link URL} to connect the registry
      * @return if not found in {@link URL#getParameters() parameters} of {@link URL registry URL}, return
-     * {@link #getDefaultMetadataStorageType()}
+     * {@link WritableMetadataService#DEFAULT_METADATA_STORAGE_TYPE}
      */
     public static String getMetadataStorageType(URL registryURL) {
-        return registryURL.getParameter(METADATA_STORAGE_TYPE_KEY, getDefaultMetadataStorageType());
+        return registryURL.getParameter(METADATA_STORAGE_TYPE_KEY, DEFAULT_METADATA_STORAGE_TYPE);
     }
 
     /**
@@ -200,23 +198,11 @@ public class ServiceInstanceMetadataUtils {
      *
      * @param serviceInstance the specified {@link ServiceInstance}
      * @return if not found in {@link ServiceInstance#getMetadata() metadata} of {@link ServiceInstance}, return
-     * {@link #getDefaultMetadataStorageType()}
+     * {@link WritableMetadataService#DEFAULT_METADATA_STORAGE_TYPE}
      */
     public static String getMetadataStorageType(ServiceInstance serviceInstance) {
         Map<String, String> metadata = serviceInstance.getMetadata();
-        return metadata.getOrDefault(METADATA_STORAGE_TYPE_KEY, getDefaultMetadataStorageType());
-    }
-
-    /**
-     * Get the default Metadata storage type from {@link ApplicationConfig} if present, or
-     * {@link WritableMetadataService#DEFAULT_METADATA_STORAGE_TYPE "default"}
-     *
-     * @return non-null
-     */
-    public static String getDefaultMetadataStorageType() {
-        return ConfigManager.getInstance().getApplication()
-                .map(ApplicationConfig::getMetadataStorageType)
-                .orElse(DEFAULT_METADATA_STORAGE_TYPE);
+        return metadata.getOrDefault(METADATA_STORAGE_TYPE_KEY, DEFAULT_METADATA_STORAGE_TYPE);
     }
 
     /**