Skip to content
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

8283779: Clarify API documentation of NetworkInterface with respect to configuration changes #20822

Closed
wants to merge 18 commits into from

Conversation

dfuch
Copy link
Member

@dfuch dfuch commented Sep 2, 2024

Please find here a change that adds a few @apiNote and @implNote to NetworkInterface to clarify user expectation and implementation.


Progress

  • Change must be properly reviewed (1 review required, with at least 1 Reviewer)
  • Change must not contain extraneous whitespace
  • Change requires CSR request JDK-8339623 to be approved
  • Commit message must refer to an issue

Issues

  • JDK-8283779: Clarify API documentation of NetworkInterface with respect to configuration changes (Enhancement - P3)
  • JDK-8339623: Clarify API documentation of NetworkInterface with respect to configuration changes (CSR)

Reviewers

Reviewing

Using git

Checkout this PR locally:
$ git fetch https://git.openjdk.org/jdk.git pull/20822/head:pull/20822
$ git checkout pull/20822

Update a local copy of the PR:
$ git checkout pull/20822
$ git pull https://git.openjdk.org/jdk.git pull/20822/head

Using Skara CLI tools

Checkout this PR locally:
$ git pr checkout 20822

View PR using the GUI difftool:
$ git pr show -t 20822

Using diff file

Download this PR as a diff file:
https://git.openjdk.org/jdk/pull/20822.diff

Webrev

Link to Webrev Comment

Sorry, something went wrong.

Verified

This commit was signed with the committer’s verified signature.
sergeyklay Serghei Iakovlev
@dfuch
Copy link
Member Author

dfuch commented Sep 2, 2024

/issue JDK-8283779

@bridgekeeper
Copy link

bridgekeeper bot commented Sep 2, 2024

👋 Welcome back dfuchs! A progress list of the required criteria for merging this PR into master will be added to the body of your pull request. There are additional pull request commands available for use with this pull request.

@openjdk
Copy link

openjdk bot commented Sep 2, 2024

@dfuch 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:

8283779: Clarify API documentation of NetworkInterface with respect to configuration changes

Reviewed-by: alanb, msheppar

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 78 new commits pushed to the master branch:

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 master branch, type /integrate in a new comment.

@openjdk openjdk bot changed the title 8283779 8283779: Clarify API documentation of NetworkInterface with respect to configuration changes Sep 2, 2024
@openjdk openjdk bot added the rfr Pull request is ready for review label Sep 2, 2024
@openjdk
Copy link

openjdk bot commented Sep 2, 2024

@dfuch This issue is referenced in the PR title - it will now be updated.

@openjdk
Copy link

openjdk bot commented Sep 2, 2024

@dfuch The following label will be automatically applied to this pull request:

  • net

When this pull request is ready to be reviewed, an "RFR" email will be sent to the corresponding mailing list. If you would like to change these labels, use the /label pull request command.

@openjdk openjdk bot added the net net-dev@openjdk.org label Sep 2, 2024
@mlbridge
Copy link

mlbridge bot commented Sep 2, 2024

@msheppar
Copy link

msheppar commented Sep 2, 2024

Also, I think it would be useful and helpful to allude to the "snapshot" characteristics of a NetworkInterface instance in the opening description of the class

public final class NetworkInterface
extends Object
This class represents a Network Interface made up of a name, and a list of IP addresses assigned to this interface. It is used to identify the local interface on which a multicast group is joined. Interfaces are normally known by names such as "le0".

Add to this description, some explanation to the fact that an instance of a NetworkInterface is reflective of its configuration at the time it was created, and that it is possible for that configuration to change due to dynamic reconfiguration policies within a host environment i.e. your "snapshot" details.

These additions of implNote and apiNote to various methods will be helpful

* @implNote
* The returned array contains all or a subset of the InetAddresses that were
* bound to the interface at the time the {@linkplain #getNetworkInterfaces()
* interface configuration was read}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think you have a typo here in that this method returns an Enumeration rather than an array.

* @apiNote
* The returned interface instance may reflect a snapshot of the
* configuration taken at the time the instance is created.
* To see updates to the configuration may, or may not, require
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The sentence "To see updates ..." is hard to read. How about "The network configuration may change at any time, this method may need to be invoked to obtain a more up to date view of the network interface".

dfuch and others added 2 commits September 3, 2024 12:12
Co-authored-by: Daniel Jelinski <djelinski1@gmail.com>
Co-authored-by: Daniel Jelinski <djelinski1@gmail.com>
@dfuch
Copy link
Member Author

dfuch commented Sep 3, 2024

/csr needed

@dfuch
Copy link
Member Author

dfuch commented Sep 3, 2024

I'll create a CSR once we have converged on the wording.

@openjdk openjdk bot added the csr Pull request needs approved CSR before integration label Sep 3, 2024
@openjdk
Copy link

openjdk bot commented Sep 3, 2024

@dfuch has indicated that a compatibility and specification (CSR) request is needed for this pull request.

@dfuch please create a CSR request for issue JDK-8283779 with the correct fix version. This pull request cannot be integrated until the CSR request is approved.

@@ -97,6 +117,11 @@ public String getName() {
* {@link NetPermission}("getNetworkInformation") permission, then all
* InetAddresses are returned.
*
* @implNote
* The returned enumeration contains all or a subset of the InetAddresses that were
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

perhaps additional comma for emphasis
The returned enumeration contains all, or a subset, of the InetAddresses . . .

@@ -116,6 +141,11 @@ public Enumeration<InetAddress> getInetAddresses() {
* {@link NetPermission}("getNetworkInformation") permission, then all
* InetAddresses are returned.
*
* @implNote
* The stream contains all or a subset of the InetAddresses that were
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

perhaps additional comma for emphasis
The stream contains all, or a subset, of the InetAddresses . . .

Copy link

@msheppar msheppar left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These are good additions and help re-enforce the current apiNote on the equals method and help bring into focus the transient and dynamic nature of NetworkInterface configurations in contemporary network environments.

@dfuch
Copy link
Member Author

dfuch commented Sep 5, 2024

I have drafted the CSR here: JDK-8339623 - Reviewers are welcome!

Copy link

@msheppar msheppar left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

FWIW . . . LGTM

@dfuch
Copy link
Member Author

dfuch commented Sep 9, 2024

I pushed a change that implement feedback received during CSR review. @AlanBateman still good to go?

* looking up a network interface again in order to obtain a new instance.
* <p>
* Network interface instances are typically used to identify the local
* interface on which a multicast group is joined.
*
Copy link

@msheppar msheppar Sep 9, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Several static methods in this class are factory methods, returning a new instance of a NetworkInterface, reflecting the configuration at the time of instantiation. The network configuration may change at any time, for example DCHP lease renewal , or IPv6 aoutconfig. As such, these methods may need to be invoked again, to obtain a more up-to-date view of the network interfaces.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Factory methods sounds good. Not sure we want to list what could cause the configuration to change: for virtual interfaces created by software components it could be just anything. I'll borrow part of your text and update.

@openjdk openjdk bot added ready Pull request is ready to be integrated and removed csr Pull request needs approved CSR before integration labels Sep 9, 2024
@dfuch
Copy link
Member Author

dfuch commented Sep 10, 2024

/integrate

@openjdk
Copy link

openjdk bot commented Sep 10, 2024

Going to push as commit c8e64cb.
Since your change was applied there have been 93 commits pushed to the master branch:

  • 9243104: 8335444: Generalize implementation of AndNode mul_ring
  • 3352522: 8338894: Deprecate jhsdb debugd for removal
  • be0dca0: 8339698: x86 unused andw/orw/xorw/addw encoding could be removed
  • 64a79d8: 8335625: Update Javadoc for GetCpuLoad
  • c246ede: 8339799: Reduce work done in j.l.invoke bytecode generators
  • 38441b3: 8339677: [vectorapi] YYYXXXVector::withLaneHelper and laneHelper should use Double::doubleToRawLongBits/Float::floatToRawIntBits
  • fb51c1e: 8339837: Remove unused BootstrapMethodsInvokers.isLambdaMetafactoryCondyBSM
  • 4d597de: 8338930: StringConcatFactory hardCoded string concatenation strategy
  • ad10493: 8338526: Don't store abstract and interface Klasses in class metaspace
  • 0d8e52b: 8339800: Prefer invokeBasic in BootstrapMethodInvokers
  • ... and 83 more: https://git.openjdk.org/jdk/compare/ad40a122d632d65052b71125c0dfd58c54e3a521...master

Your commit was automatically rebased without conflicts.

@openjdk openjdk bot added the integrated Pull request has been integrated label Sep 10, 2024
@openjdk openjdk bot closed this Sep 10, 2024
@openjdk openjdk bot removed ready Pull request is ready to be integrated rfr Pull request is ready for review labels Sep 10, 2024
@openjdk
Copy link

openjdk bot commented Sep 10, 2024

@dfuch Pushed as commit c8e64cb.

💡 You may see a message that your pull request was closed with unmerged commits. This can be safely ignored.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
integrated Pull request has been integrated net net-dev@openjdk.org
Development

Successfully merging this pull request may close these issues.

None yet

4 participants