I think we should focus on "data" and "transactions". "Threads" and "Network 
Resources" will collected by operation system when process exit and sometimes 
is very hard to clean.


Now java-chassis doing the following:
1. A shutdown hook for spring context shutdown and unregistered from service 
center
2. A shutdown hook waiting for all invocations to finish


As users can add their owner shutdown hooks to clean business data, I think we 
do not necessarily provide other ways(like events) .


If someone provide some more scenarios related to "data" and "transactions" is 
preferred.




------------------ ???????? ------------------
??????: "willem.jiang"<willem.ji...@gmail.com>;
????????: 2018??5??8??(??????) ????2:56
??????: "dev"<dev@servicecomb.apache.org>;

????: Re: [Discussion]What Java Chassis need to do for support Gracefully 
Shutdown



My suggestion is register a shutdown callback (to do 1,2,4) in the
ApplicationContext.
In this way we can do some clean up work with or without Spring.


Willem Jiang

Blog: http://willemjiang.blogspot.com (English)
          http://jnn.iteye.com  (Chinese)
Twitter: willemjiang
Weibo: ????willem

On Tue, May 8, 2018 at 2:53 PM, ?????? <yangyong.zh...@qq.com> wrote:

> Hi All:
>    In order to let Java Chassis support Gracefully Shutdown, I think need
> to do these works :
>    1.Unregister microservice instance from Service Center(clean service
> registry).
>    2.Stop all network transport threads (vertx eventloop-threads)(to
> prevent blocking exit).
>    3.Close ClassPathXmlApplicationContext created in BeanUtils.init() and
> release all resources and locks.
>    4.Raise an ShutdownEvent in EventBus.
>
>    Also if user directly call `System.exit(0)` , all these works will done
> and jvm can terminate with `Process finished with exit code 0`.
>
>    What's missing or any suggestions are welcome !
>
>  Best Regards!
>  YangYongZheng

Reply via email to