#1951 refactor: replace linear proxy scan with lookup map in MultiProxyManager#1954
Conversation
ebe2ba1 to
736266b
Compare
|
Thanks for the refactor, the O(n) to O(1) lookup and folding proxy identity into 1. Missing tests for the new
2. Mutable fields used in the hash key. Minor: the diff also carries unrelated reformatting in |
736266b to
da687d7
Compare
…ltiProxyManager
da687d7 to
fc5e0ae
Compare
dpol1
left a comment
There was a problem hiding this comment.
lgtm — Map lookup preserves isSameProxy identity semantics, username/password final is the right fix for hash key, tests cover it — Thanks for the contribution @leedongkyu0407
|
Thank you for the review and guidance! |
Closes #1951
Summary
Replace the O(n) linear scan in
getConfiguredProxy()with an O(1) map lookup by putting proxy identity on the type itself.Changes
equals/hashCodetoSCProxybased on identity fields only:protocolandaddress(lowercased),port,username,password. Excludescountry,area,location,status, andusage.Map<SCProxy, SCProxy>in bothconfigure()overloads and replacedgetConfiguredProxywithOptional.ofNullable(map.get(proxy))ProxyUtils.isSameProxyand its privatenormalizehelper, folding the logic intoSCProxy.equalsNotes
MultiProxyManagerTest: 13/13 passedProtocolTest.testBlockingfailure is pre-existing and unrelated to this changeFor all changes
#XXXXwhereXXXXis the issue number you are trying to resolve?mvn git-code-format:format-code -Dgcf.globPattern="**/*" -Dskip.format.code=false?For code changes
mvn clean verify?