-
Notifications
You must be signed in to change notification settings - Fork 426
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Clean up SocketFinder.findSocket(...) handling #663
Clean up SocketFinder.findSocket(...) handling #663
Conversation
Codecov Report
@@ Coverage Diff @@
## dev #663 +/- ##
============================================
- Coverage 48.32% 48.16% -0.16%
- Complexity 2623 2625 +2
============================================
Files 113 113
Lines 26626 26609 -17
Branches 4480 4472 -8
============================================
- Hits 12867 12817 -50
- Misses 11601 11662 +61
+ Partials 2158 2130 -28
Continue to review full report at Codecov.
|
8bd7d2f
to
0f5c355
Compare
Hi @sehrope , Would you mind resolving the conflicts? |
0f5c355
to
c433c4f
Compare
@ulvii Done. |
Refactors socket creation in SocketFinder.findSocket(...) to simplify handling of socket creation. When the host resolves to a single address the driver now defers to getConnectedSocket(...) to create the socket without spawning any threads. This happens regardless of whether we're running on an IBM JDK. Previously the single address case would still use NIO on an IBM JDK. On non-IBM JDKs the driver now handles both IPv4 and IPv6 addresses concurrently with a single shared timeout. Previously hosts that resolved to both types of addresses were allowed half the timeout for socket creation per address type with the resolution performed sequentially.
c433c4f
to
487574e
Compare
One more rebase as dev has been updated since the last one. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I agree with the advantage of having a generic implementation for IBM JDK and OpenJDK - which was differently done before, also using full timeout for all IP addresses instead of splitting half between IPv4 and IPv6 makes it better.
Cleans up
SocketFinder.findSocket(...)
a bit and simplifies the logic for the simple case of a single address being resolved.This changes some of the prior functionality though I wouldn't consider it a breaking change as it's not documented functionality and the new approach seems (to me) to be more correct. Previously if a host resolved to both IPv4 and IPv6 addresses, each set would get half the time out and the IPv4 addresses would be attempted first. This PR changes the logic to handle all IP addresses concurrently using the full timeout.
It also centralizes the logic for handling the case where there's a single address. Regardless of JVM type it now attempts to directly connect to it. This changes the behavior for the IBM JDK as previously it would have attempted the NIO approach followed by a normal socket creation upon success. Again this seems like a better choice as the overall logic is simpler and end result is the same.
This PR was coded atop #662. See there for more details on the parent change.