Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Reload
DocService
on server reconfigure (#4513)
Motivation: Previously, `DocService` wasn't able to handle the changed services as a result of `reconfigure`. ``` sb = Server.builder() .annotatedService("/hello", new HelloService()) .serviceUnder("/docs", DocService.builder().build()) ... sb.reconfigure(sb2 -> sb2.annotatedService("/hello2", new HelloService()) .serviceUnder("/docs", DocService.builder().build())) ``` - If a shared `DocService` is used, services wouldn't be updated and the old specification would be used. - If a new `DocService` is added, appropriate callbacks wouldn't be called and `/specifications.json` would result in a 404. https://github.com/line/armeria/blob/cae3b6da373101c0976e2d00f1f3cbb706d07e00/core/src/main/java/com/linecorp/armeria/server/docs/DocService.java#L217-L220 We may note that `Server#configs` is immutable, and that `Server#configs` is fixed at the timing when the `serviceAdded` callback is called. https://github.com/line/armeria/blob/cae3b6da373101c0976e2d00f1f3cbb706d07e00/core/src/main/java/com/linecorp/armeria/server/DefaultServerConfig.java#L246 Modifications: - Change the timing when `DocService#specifications` is loaded to `DecoratingService#serviceAdded`. Result: - Users can use `DocService` even when `Server#reconfigure` is called. Note: This PR contains changes from #4491 . Review this PR first 🙏
- Loading branch information