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

8350279: HttpClient: Add a new HttpResponse method to identify connections #24154

Open
wants to merge 11 commits into
base: master
Choose a base branch
from

Conversation

vy
Copy link
Contributor

@vy vy commented Mar 21, 2025

Adds HttpResponse::connectionLabel method that provides an identifier for the connection.

Implementation note: The feature is facilitated by HttpConnection::label, which should not be confused with HttpConnection::id. This distinction is explained in the JavaDoc of both properties.


Progress

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

Issues

  • JDK-8350279: HttpClient: Add a new HttpResponse method to identify connections (Enhancement - P4)
  • JDK-8352751: HttpClient: Add a new HttpResponse method to identify connections (CSR)

Reviewing

Using git

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

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

Using Skara CLI tools

Checkout this PR locally:
$ git pr checkout 24154

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

Using diff file

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

Using Webrev

Link to Webrev Comment

Sorry, something went wrong.

vy added 8 commits March 21, 2025 14:43

Unverified

The email in this signature doesn’t match the committer email.

Unverified

The email in this signature doesn’t match the committer email.

Unverified

The email in this signature doesn’t match the committer email.

Unverified

The email in this signature doesn’t match the committer email.

Unverified

The email in this signature doesn’t match the committer email.

Unverified

The email in this signature doesn’t match the committer email.

Unverified

The email in this signature doesn’t match the committer email.

Unverified

The email in this signature doesn’t match the committer email.
@bridgekeeper
Copy link

bridgekeeper bot commented Mar 21, 2025

👋 Welcome back vyazici! 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 Mar 21, 2025

❗ This change is not yet ready to be integrated.
See the Progress checklist in the description for automated requirements.

@openjdk
Copy link

openjdk bot commented Mar 21, 2025

@vy 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 net [email protected] rfr Pull request is ready for review labels Mar 21, 2025
@mlbridge
Copy link

mlbridge bot commented Mar 21, 2025

Webrevs

@dfuch
Copy link
Member

dfuch commented Mar 21, 2025

/csr required

@openjdk
Copy link

openjdk bot commented Mar 21, 2025

@dfuch usage: /csr [needed|unneeded], requires that the issue the pull request refers to links to an approved CSR request.

@liach
Copy link
Member

liach commented Mar 23, 2025

This new API returns an Optional.

  1. Can users make any assumption about the connection identity when it is empty? Such as assuming such connections are all the same (as implied by your use of orElse(null) in tests) or all different?
  2. If we cannot make any assumption about the empty return value, can users make any assumption that a HttpResponse obtained from the JDK built-in HttpClient always return non-empty for the label?

vy and others added 3 commits March 24, 2025 11:09

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.
…nectionLabel`

Co-authored-by: Daniel Fuchs <[email protected]>

Unverified

The email in this signature doesn’t match the committer email.

Unverified

The email in this signature doesn’t match the committer email.
…nectionLabelTest`
@vy
Copy link
Contributor Author

vy commented Mar 24, 2025

/csr needed

@openjdk openjdk bot added the csr Pull request needs approved CSR before integration label Mar 24, 2025
@openjdk
Copy link

openjdk bot commented Mar 24, 2025

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

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

@dfuch
Copy link
Member

dfuch commented Mar 24, 2025

  • Can users make any assumption about the connection identity when it is empty? Such as assuming such connections are all the same (as implied by your use of orElse(null) in tests) or all different?

No. If empty is returned you can make no assumptions. In practice this should never be null with our impl (except possibly in whitebox tests)

  • If we cannot make any assumption about the empty return value, can users make any assumption that a HttpResponse obtained from the JDK built-in HttpClient always return non-empty for the label?

Yes.

@liach
Copy link
Member

liach commented Mar 24, 2025

If we cannot make any assumption about the empty return value, can users make any assumption that a HttpResponse obtained from the JDK built-in HttpClient always return non-empty for the label?
Yes.

Should we specify this, like "The JDK built-in implementation of the {@code HttpClient} always assign a label to connections it create"?

@dfuch
Copy link
Member

dfuch commented Mar 24, 2025

Should we specify this, like "The JDK built-in implementation of the {@code HttpClient} always assign a label to connections it create"?

Good question - that would be an @implNote - but I'm not sure this is required. The caller can determine whether a connection label is provided by testing whether the optional is empty.

* <p>
* The format of the string is opaque, but the content should be unique
* for the lifetime of the {@link HttpClient} instance.
*
Copy link
Member

@Michael-Mc-Mahon Michael-Mc-Mahon Mar 25, 2025

Choose a reason for hiding this comment

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

How about changing the wording to something like:

The format of the string is opaque, but the value will be fixed and unique for any connection, for the lifetime of its {@link HttpClient instance.

Copy link
Member

@dfuch dfuch Mar 25, 2025

Choose a reason for hiding this comment

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

How about:

The format of the string is opaque, but the value is fixed and unique for any connection in the scope of the associated {@link HttpClient} instance.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
csr Pull request needs approved CSR before integration net [email protected] rfr Pull request is ready for review
Development

Successfully merging this pull request may close these issues.

None yet

4 participants