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

albumenj pushed a commit to branch 3.2
in repository https://gitbox.apache.org/repos/asf/dubbo.git


The following commit(s) were added to refs/heads/3.2 by this push:
     new 7b595b19bf Enhance shutdown hook logs (#12336)
7b595b19bf is described below

commit 7b595b19bf5ac96065ce6bdba99607fc970d07a5
Author: Albumen Kevin <[email protected]>
AuthorDate: Wed May 17 14:51:15 2023 +0800

    Enhance shutdown hook logs (#12336)
---
 .../java/org/apache/dubbo/config/DubboShutdownHook.java    | 14 +++++++++-----
 1 file changed, 9 insertions(+), 5 deletions(-)

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 3172525e72..def7a7ac74 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
@@ -90,7 +90,7 @@ public class DubboShutdownHook extends Thread {
 
         boolean hasModuleBindSpring = false;
         // check if any modules are bound to Spring
-        for (ModuleModel module: applicationModel.getModuleModels()) {
+        for (ModuleModel module : applicationModel.getModuleModels()) {
             if (module.isLifeCycleManagedExternally()) {
                 hasModuleBindSpring = true;
                 break;
@@ -104,14 +104,14 @@ public class DubboShutdownHook extends Thread {
                   To avoid shutdown conflicts between Dubbo and Spring,
                   wait for the modules bound to Spring to be handled by Spring 
until timeout.
                  */
-                logger.info("Waiting for modules managed by Spring to be 
shutdown.");
+                logger.info("Waiting for modules(" + 
applicationModel.getDesc() + ") managed by Spring to be shutdown.");
                 while (!applicationModel.isDestroyed() && hasModuleBindSpring
                     && (System.currentTimeMillis() - start) < timeout) {
                     try {
                         TimeUnit.MILLISECONDS.sleep(10);
                         hasModuleBindSpring = false;
                         if (!applicationModel.isDestroyed()) {
-                            for (ModuleModel module: 
applicationModel.getModuleModels()) {
+                            for (ModuleModel module : 
applicationModel.getModuleModels()) {
                                 if (module.isLifeCycleManagedExternally()) {
                                     hasModuleBindSpring = true;
                                     break;
@@ -123,11 +123,15 @@ public class DubboShutdownHook extends Thread {
                         Thread.currentThread().interrupt();
                     }
                 }
+                if (!applicationModel.isDestroyed()) {
+                    long usage = System.currentTimeMillis() - start;
+                    logger.info("Dubbo wait for application(" + 
applicationModel.getDesc() + ") managed by Spring to be shutdown failed, " +
+                        "time usage: " + usage + "ms");
+                }
             }
         }
         if (!applicationModel.isDestroyed()) {
-            logger.info("Dubbo shuts down application " +
-                "after Spring fails to do in time or doesn't do it 
completely.");
+            logger.info("Dubbo shutdown hooks execute now. " + 
applicationModel.getDesc());
             applicationModel.destroy();
         }
     }

Reply via email to