line / armeria

Your go-to microservice framework for any situation, from the creator of Netty et al. You can build any type of microservice leveraging your favorite technologies, including gRPC, Thrift, Kotlin, Retrofit, Reactive Streams, Spring Boot and Dropwizard.
https://armeria.dev
Apache License 2.0
4.73k stars 899 forks source link

Close the default `ClientFactory` after a server stops in Spring integration #5742

Closed ikhoon closed 3 weeks ago

ikhoon commented 3 weeks ago

Motivation:

I tried to add a graceful shutdown timeout to not immediately close the default ClientFactory. https://github.com/line/armeria/pull/5718#discussion_r1624232941 However, it is a breaking change and no agreement has been reached on the default behavior.

I think that #5718 may take some time to be merged or may not be merged.

This problem can be solved more easily in Spring Boot. Spring Boot starts the application in the main method and terminates with JVM shutdown. By shutting down the default ClientFactory using SpringApplicationShutdownHook, the graceful shutdown can be supported without breaking changes for Spring integration, which is used by most users.

Modifications:

Result:

In Spring integration, the default ClientFactory is now gracefully closed after the server is shut down.

github-actions[bot] commented 3 weeks ago

๐Ÿ” Build Scanยฎ (commit: 781fb303dcd5beee50f83272c8141075ce4adb0e)

Job name Status Build Scanยฎ
build-windows-latest-jdk-21 โœ… https://ge.armeria.dev/s/lzmzyei47rrhg
build-self-hosted-unsafe-jdk-8 โœ… https://ge.armeria.dev/s/oagidho7ajthi
build-self-hosted-unsafe-jdk-21-snapshot-blockhound โœ… https://ge.armeria.dev/s/l5t5zstec5z3y
build-self-hosted-unsafe-jdk-17-min-java-17-coverage โœ… https://ge.armeria.dev/s/bw7rfl7v7hsi4
build-self-hosted-unsafe-jdk-17-min-java-11 โœ… https://ge.armeria.dev/s/spdfphqikr7yw
build-self-hosted-unsafe-jdk-17-leak โœ… https://ge.armeria.dev/s/wukc2dqpz37ao
build-self-hosted-unsafe-jdk-11 โœ… https://ge.armeria.dev/s/3h76hk53qokfm
build-macos-12-jdk-21 โœ… https://ge.armeria.dev/s/6ie5643aehvde
minwoox commented 3 weeks ago

๐Ÿ‘ ๐Ÿ‘ ๐Ÿ‘