forked from netty/netty
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Implement RoundRobin logic in RoundRobinInetAddressResolver#resolveAll
Motivation: Now the ```resolveAll``` method of RoundRobinInetAddressResolver returns results without any rotation and shuffling. As a result, it doesn't force any round-robin for clients that get a result of ```resolveAll``` and use addresses from the result one by one for a connection establishing until success. This commit implements round-robin in RoundRobinInetAddressResolver#resolveAll. These improvements inspired by the discussion here: AsyncHttpClient/async-http-client#1285 Modifications: Rotate collection from internal ```resolveAll``` call by index, which is incremented every call to RoundRobinInetAddressResolver#resolveAll method. Random replaced by an incrementing counter, which makes code cheaper and guarantees predictable address order in tests. Result: Improved ```RoundRobinInetAddressResolver``` is compatible with clients that use ```resolveAll``` result.
- Loading branch information
1 parent
b4e5965
commit 5eebe9a
Showing
1 changed file
with
41 additions
and
21 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