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

liubao pushed a commit to branch 2.8.x
in repository https://gitbox.apache.org/repos/asf/servicecomb-java-chassis.git


The following commit(s) were added to refs/heads/2.8.x by this push:
     new 01e459575 [#4049]fix shutdown in progress exception problem (#4102)
01e459575 is described below

commit 01e459575a2c7bab82b31d8e5ba67be81534d29b
Author: liubao68 <[email protected]>
AuthorDate: Thu Dec 7 15:35:03 2023 +0800

    [#4049]fix shutdown in progress exception problem (#4102)
---
 .../main/java/org/apache/servicecomb/core/SCBEngine.java   | 14 --------------
 1 file changed, 14 deletions(-)

diff --git a/core/src/main/java/org/apache/servicecomb/core/SCBEngine.java 
b/core/src/main/java/org/apache/servicecomb/core/SCBEngine.java
index 9b546f939..df58e1599 100644
--- a/core/src/main/java/org/apache/servicecomb/core/SCBEngine.java
+++ b/core/src/main/java/org/apache/servicecomb/core/SCBEngine.java
@@ -129,8 +129,6 @@ public class SCBEngine {
 
   private final VendorExtensions vendorExtensions = new VendorExtensions();
 
-  private Thread shutdownHook;
-
   protected SCBEngine() {
     eventBus = EventManager.getEventBus();
     eventBus.register(this);
@@ -389,9 +387,6 @@ public class SCBEngine {
 
     RegistrationManager.INSTANCE.run();
     DiscoveryManager.INSTANCE.run();
-
-    shutdownHook = new Thread(this::destroyForShutdownHook);
-    Runtime.getRuntime().addShutdownHook(shutdownHook);
   }
 
   private void createProducerMicroserviceMeta() {
@@ -403,11 +398,6 @@ public class SCBEngine {
     producerMicroserviceMeta.setMicroserviceVersionsMeta(new 
MicroserviceVersionsMeta(this, microserviceName));
   }
 
-  public void destroyForShutdownHook() {
-    shutdownHook = null;
-    destroy();
-  }
-
   /**
    * not allow throw any exception
    * even some step throw exception, must catch it and go on, otherwise 
shutdown process will be broken.
@@ -422,10 +412,6 @@ public class SCBEngine {
   }
 
   private void doDestroy() {
-    if (shutdownHook != null) {
-      Runtime.getRuntime().removeShutdownHook(shutdownHook);
-    }
-
     //Step 0: turn down the status of this instance in service center,
     // so that the consumers can remove this instance record in advance
     turnDownInstanceStatus();

Reply via email to