zhengyangyong opened a new pull request #693: [SCB-548] support gracefully 
shutdown
URL: https://github.com/apache/incubator-servicecomb-java-chassis/pull/693
 
 
   Signed-off-by: zhengyangyong <yangyong.zh...@huawei.com>
   
   Follow this checklist to help us incorporate your contribution quickly and 
easily:
   
    - [x] Make sure there is a [JIRA 
issue](https://issues.apache.org/jira/browse/SCB) filed for the change (usually 
before you start working on it).  Trivial changes like typos do not require a 
JIRA issue.  Your pull request should address just this issue, without pulling 
in other changes.
    - [x] Each commit in the pull request should have a meaningful subject line 
and body.
    - [x] Format the pull request title like `[SCB-XXX] Fixes bug in 
ApproximateQuantiles`, where you replace `SCB-XXX` with the appropriate JIRA 
issue.
    - [x] Write a pull request description that is detailed enough to 
understand what the pull request does, how, and why.
    - [x] Run `mvn clean install` to make sure basic checks pass. A more 
thorough check will be performed on your pull request automatically.
    - [x] If this contribution is large, please file an Apache [Individual 
Contributor License Agreement](https://www.apache.org/licenses/icla.pdf).
   
   ---
   When user call system.exit(0),these three works will do:
   1.Unregister microservice instance from Service Center:
   this work will do by process ContextClosedEvent, we need unregister 
immediately for stopping provide service any more.
   2.Waiting for all invocations to finish:
   this work will do by ShutdownHandler, when all invocations finished or 
'deadline time reached', cc and transport vertx threads will close.
   3.All spring bean do close process
   we had registerShutdownHook for spring ApplicationContext and beans can 
define 'destroy-method' do cleaning.
   
   here is example:
    
   Spring mvc Hello Java Chassis
   Pojo Hello person ServiceComb/Java Chassis
   Jaxrs Hello person ServiceComb/Java Chassis
   Spring mvc Hello person ServiceComb/Java Chassis
   2018-05-09 16:02:14,288 [WARN] handler chain is shutting down 
org.apache.servicecomb.core.handler.ShutdownHookHandler.run(ShutdownHookHandler.java:87)
   2018-05-09 16:02:14,289 [INFO] Closing 
org.springframework.context.support.ClassPathXmlApplicationContext@7cf10a6f: 
startup date [Wed May 09 16:02:05 CST 2018]; root of context hierarchy 
org.springframework.context.support.AbstractApplicationContext.doClose(AbstractApplicationContext.java:984)
   2018-05-09 16:02:14,290 [WARN] cse is closing now... 
org.apache.servicecomb.core.CseApplicationListener.onApplicationEvent(CseApplicationListener.java:148)
   2018-05-09 16:02:14,291 [INFO] service center task is shutdown. 
org.apache.servicecomb.serviceregistry.registry.RemoteServiceRegistry.onShutdown(RemoteServiceRegistry.java:72)
   2018-05-09 16:02:14,295 [WARN] handler chain is shut down 
org.apache.servicecomb.core.handler.ShutdownHookHandler.run(ShutdownHookHandler.java:103)
   2018-05-09 16:02:14,296 [INFO] Unregister microservice instance success. 
microserviceId=90b76fd551c511e8b51db4b676a39f40 
instanceId=481f630d535f11e8bc19b4b676a39f40 
org.apache.servicecomb.serviceregistry.registry.AbstractServiceRegistry.unregisterInstance(AbstractServiceRegistry.java:232)
   Process finished with exit code 0

----------------------------------------------------------------
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:
us...@infra.apache.org


With regards,
Apache Git Services

Reply via email to