-
Notifications
You must be signed in to change notification settings - Fork 5.8k
8244202: Implementation of JEP 418: Internet-Address Resolution SPI #5822
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
8244202: Implementation of JEP 418: Internet-Address Resolution SPI #5822
Conversation
👋 Welcome back aefimov! A progress list of the required criteria for merging this PR into |
@AlekseiEfimov The following labels will be automatically applied to this pull request:
When this pull request is ready to be reviewed, an "RFR" email will be sent to the corresponding mailing lists. If you would like to change these labels, use the /label pull request command. |
Webrevs
|
...ider/providers/recursive/recursive.init.provider/impl/InetAddressUsageInGetProviderImpl.java
Show resolved
Hide resolved
What’s in a name? For the method names lookupHostname, and lookupAddresses, I would proffer a method name change to use lookup and reverseLookup Thus, lookupHostname should be renamed to reverseLookup and |
Refactor remove Configuration and simplify interface: In the InetAddressResolver a Configuration abstraction is defined, and this is supplied to The objective is to “inject” some platform configuration into an InetAddressResolver. This So Suggestion is refector remove Configuration to simplify the interface and provide the |
During work on this JEP we've examined the approach suggested above, and there are few issues with it:
It's been also discussed in the CSR comments here |
I'm not sure that I see an ambiguity here: We can try and apply this approach to the description of DNS operations above:
operation:
operation: |
Right, I think we've ended up with a good model here that supports the common case, stacking, and can be extended in the future to add new configuration if required. Also if good use-cases come up when Configuration can be changed to be non-sealed. |
Yes, ambiguity wasn’t quite the word I was looking for. Maybe contradictory or oxymoron might do !! To re-iterate, the parlance of the DNS domain in context of address resolution is lookup for hostname to IP address resolution and reverse lookup for address to hostname mapping. For me, the natural verb to method translation is lookup and **reverseLookup OR resolveHostname and resolveAddress. The latter names are pretty definitive and unambiguous. It clear and obvious without the need to pursue the full signature of the method, what the semantics of the methods should be. At the java InetAddress API level there is getByName(String host) and getByAddress(byte[] addr). getByName requires a hostname lookup and getByAdress requires (eventually - I know the docs says there’s no reverse lookup) an address reverse lookup. Thus, a logical mapping is getByName —> lookupHostname, and getByAddr —> lookupAddress, but the opposite will occur getByName --> lookupAddresses and getByAddress --> lookupHostname. Therfore I proffer maps neatly to rename methods to resolveHostname and resolveAddress such that the mapping are getByName --> resolveHostname and getByAddress --> resolveAddress. I will concede that it can be reasonable argued that the native library functions getnameinfo and getaddrinfo may better abstract to lookupHostname and lookupAddresses respectively. But, I have always found these two library calls a bit contorted and the legacy gethostbyname and gethostbyaddress were more logical. In you proposition above:
You are generating the name from the result of the action. I’m arguing that it should be based on the operation on the subject i.e. the parameter being passed. Of course, it is possible to just overload a lookup method, one taking Sting and t’other taking byte adder in the method’s parameters, respectively. Then, you don’t have to concede too much in this argument. |
OK grand ... I didn't see the CSR discussion :-( WRT hostname being dynamic and requires a lambda ... is it really dynamic? In the case of working over VPN, VPN software usually changes the hostname dynamically, but that name change is only valid for the duration of the VPN session, and when you exit the VPN, it reverts back to the original hostname. In such cases an application will need to be restarted. There's no seemless working from VPN to non VPN. I think that a hostname is constant while a host is up, but it can be changed, and when changed a host restart is required. I don't think it is quite as dynamic as has been suggested, but I open to correction. It is something that can be investigated. |
It is possible to change a host name without host restart. What has been tested:
I believe it proves that we need to treat a host name as dynamically changing information. |
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.
Changes look good to me.
@AlekseiEfimov This change now passes all automated pre-integration checks. ℹ️ This project also has non-automated pre-integration requirements. Please see the file CONTRIBUTING.md for details. After integration, the commit message for the final commit will be:
You can use pull request commands such as /summary, /contributor and /issue to adjust it as needed. At the time when this comment was updated there had been 15 new commits pushed to the
As there are no conflicts, your changes will automatically be rebased on top of these commits when integrating. If you prefer to avoid this automatic rebasing, please check the documentation for the /integrate command for further details. ➡️ To integrate this PR with the above commit message to the |
/csr needed |
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.
Thanks for the updates to the API docs, you've addressed all my comments.
@AlekseiEfimov this pull request can not be integrated into git checkout JDK-8244202_JEP418_impl
git fetch https://git.openjdk.java.net/jdk master
git merge FETCH_HEAD
# resolve conflicts and follow the instructions given by git merge
git commit -m "Merge master"
git push |
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.
LGTM.
/contributor add chegar |
@AlekseiEfimov |
@AlekseiEfimov |
@AlekseiEfimov |
/integrate |
Going to push as commit 2ca4ff8.
Your commit was automatically rebased without conflicts. |
@AlekseiEfimov Pushed as commit 2ca4ff8. 💡 You may see a message that your pull request was closed with unmerged commits. This can be safely ignored. |
This change implements a new service provider interface for host name and address resolution, so that java.net.InetAddress API can make use of resolvers other than the platform's built-in resolver.
The following API classes are added to
java.net.spi
package to facilitate this:InetAddressResolverProvider
- abstract class defining a service, and is, essentially, a factory forInetAddressResolver
resolvers.InetAddressResolverProvider.Configuration
- an interface describing the platform's built-in configuration for resolution operations that could be used to bootstrap a resolver construction, or to implement partial delegation of lookup operations.InetAddressResolver
- an interface that defines methods for the fundamental forward and reverse lookup operations.InetAddressResolver.LookupPolicy
- a class whose instances describe the characteristics of one forward lookup operation.More details in JEP-418.
Testing: new and existing
tier1:tier3
testsProgress
Issue
Reviewers
Contributors
<chegar@openjdk.org>
<dfuchs@openjdk.org>
<alanb@openjdk.org>
Reviewing
Using
git
Checkout this PR locally:
$ git fetch https://git.openjdk.java.net/jdk pull/5822/head:pull/5822
$ git checkout pull/5822
Update a local copy of the PR:
$ git checkout pull/5822
$ git pull https://git.openjdk.java.net/jdk pull/5822/head
Using Skara CLI tools
Checkout this PR locally:
$ git pr checkout 5822
View PR using the GUI difftool:
$ git pr show -t 5822
Using diff file
Download this PR as a diff file:
https://git.openjdk.java.net/jdk/pull/5822.diff