-
Notifications
You must be signed in to change notification settings - Fork 183
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Adjusting
ServiceDiscovererEvent
contract (#1906)
Motivation: Current API of `ServiceDiscovererEvent` is capable of representing the boolean status of the host being either available or not available. As seen in the implementation of RoundRobinLoadBalancer`, the resulting states from the Service Discovery system can have more meanings than a simple boolean. To prepare for enhanecements, the contract has been adjusted to allow more states and make it possible for further additions if those are needed by particular implementations. Modifications: - Deprecated `ServiceDiscovererEvent#isAvailable` method and added a default implementation to allow removal in child classes, - Added `ServiceDiscovererEvent.Status` class with `AVAILABLE`, `EXPIRED`, and `UNAVAILABLE` statuses, - Added `ServiceDiscovererEvent#status` method with default implementation to prevent breaking the existing implementations, - Replaced existing uses of `isAvailable` with comparisons of `status` against the constants in `ServiceDiscoveryStatus`, - `DefaultDnsClient` is capable of returning either of `UNAVAILABLE` or `EXPIRED` statuses for missing records, according to setting in `DefaultDnsServiceDiscovererBuilder#missingRecordStatus`. - `RoundRobinLoadBalancer` is able to act accordingly to received status, - `RoundRobinLoadBalancer#eagerConnectionShutdown` setting has been adjusted to allow no influence over received status and provides functionality when necessary for mapping `UNAVAILABLE` to `EXPIRED` and vice-versa. Result: `ServiceDiscovererEvent`s are prepared for more advanced, non-binary statuses. An example is the now introduced `EXPIRED` event, which has a different meaning than `UNAVAILABLE`. If the `ServiceDiscoverer` decides to emit such a status, the subscribers can provide additional functionality in that case such as the behavior provided by `RoundRobinLoadBalancer`.
- Loading branch information
Dariusz Jedrzejczyk
committed
Nov 15, 2021
1 parent
6f50031
commit ad81b3f
Showing
24 changed files
with
720 additions
and
323 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.