zhengyangyong commented on issue #693: [SCB-548] support gracefully shutdown
URL: 
https://github.com/apache/incubator-servicecomb-java-chassis/pull/693#issuecomment-388301667
 
 
   improve gracefully shutdown process order
   ```java
     private void gracefullyShutdown() {
       //Step 1: notify all component stop invoke via BEFORE_CLOSE Event
       triggerEvent(EventType.BEFORE_CLOSE);
   
       //Step 2: Unregister microservice instance from Service Center and close 
vertx
       RegistryUtils.destroy();
       VertxUtils.closeVertxByName("registry");
   
       //Step 3: wait all invocation finished
       try {
         ShutdownHookHandler.INSTANCE.ALL_INVOCATION_FINISHED.acquire();
         LOGGER.warn("all invocation finished");
       } catch (InterruptedException e) {
         LOGGER.error("invocation finished semaphore interrupted", e);
       }
   
       //Step 4: Stop vertx to prevent blocking exit
       VertxUtils.closeVertxByName("config-center");
       VertxUtils.closeVertxByName("transport");
   
       //Step 5: notify all component do clean works via AFTER_CLOSE Event
       triggerEvent(EventType.AFTER_CLOSE);
     }
   ```

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

Reply via email to