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

8253178: Replace LinkedList Impl in net.http.FilterFactory #4721

Conversation

fdesu
Copy link
Contributor

@fdesu fdesu commented Jul 8, 2021

This patch replaces a LinkedList data structure used in the net.http.FilterFactory class with an ArrayList. This issue relates to JDK-8246048: Replace LinkedList with ArrayLists in java.net..

The list created once per HttpClient and filled with upfront known values (3 of them in the jdk.internal.net.http.HttpClientImpl#initFilters: AuthenticationFilter.class, RedirectFilter.class and depending on the presence of a cookieHandler - a CookieFilter.class).


Progress

  • Change must not contain extraneous whitespace
  • Commit message must refer to an issue
  • Change must be properly reviewed

Issue

  • JDK-8253178: Replace LinkedList Impl in net.http.FilterFactory

Reviewers

Reviewing

Using git

Checkout this PR locally:
$ git fetch https://git.openjdk.java.net/jdk pull/4721/head:pull/4721
$ git checkout pull/4721

Update a local copy of the PR:
$ git checkout pull/4721
$ git pull https://git.openjdk.java.net/jdk pull/4721/head

Using Skara CLI tools

Checkout this PR locally:
$ git pr checkout 4721

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

Using diff file

Download this PR as a diff file:
https://git.openjdk.java.net/jdk/pull/4721.diff

@bridgekeeper
Copy link

bridgekeeper bot commented Jul 8, 2021

👋 Welcome back fdesu! 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 openjdk bot added the rfr Pull request is ready for review label Jul 8, 2021
@openjdk
Copy link

openjdk bot commented Jul 8, 2021

@fdesu 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 Jul 8, 2021
@mlbridge
Copy link

mlbridge bot commented Jul 8, 2021

Webrevs


public void addFilter(Class<? extends HeaderFilter> type) {
filterClasses.add(type);
}

LinkedList<HeaderFilter> getFilterChain() {
LinkedList<HeaderFilter> l = new LinkedList<>();
List<HeaderFilter> getFilterChain() {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

I was thinking about the ways how FilterChain could be simplified. I played around with the List<Supplier<HeaderFilter>> instead of List<Class<? extends HeaderFilter>> and it seems that such change might improve the FilterFactory:

    List<HeaderFilter> getFilterChain() {
        return filterSuppliers.stream()
                .map(Supplier::get)
                .toList();
    }

There is no constructor reflective access anymore, hence no exception handling.
Drawback here would be that HttpClientImpl in the initFilters will need to add suppliers vs classes i.e. filters.addFilter(AuthenticationFilter::new); vs addFilter(AuthenticationFilter.class);.

I think FilterFactory looks a bit simpler this way.
What do you think, should we go ahead with the change?

@fdesu fdesu force-pushed the remove-usages-of-linkedlist-in-netHttpFilterFactory branch from 31ab71b to 3991ea5 Compare July 19, 2021 10:18
@fdesu
Copy link
Contributor Author

fdesu commented Jul 19, 2021

Hi, could anyone please help me out with this patch? I am glad to fix problems that you might spot here, otherwise it would be awesome if someone could sponsor this change!

@fdesu
Copy link
Contributor Author

fdesu commented Aug 16, 2021

Hi, it would be great if anyone would have time to take a quick look on this pull request. I hope this change is still relevant and I am happy to have any feedback from you. Thanks!

@dfuch
Copy link
Member

dfuch commented Aug 17, 2021

Hi Sergei - I will have a look. It may take some time until I come back to you (my apologies).

Copy link
Member

@dfuch dfuch left a comment

Choose a reason for hiding this comment

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

LGTM. I can sponsor once you have integrated
.

@openjdk
Copy link

openjdk bot commented Aug 23, 2021

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

8253178: Replace LinkedList Impl in net.http.FilterFactory

Reviewed-by: dfuchs

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

  • 594e516: 8272778: Consolidate is_instance and is_instance_inlined in java_lang_String
  • d542745: 8267894: Skip work for empty regions in G1 Full GC
  • 741f58c: 8272417: ZGC: fastdebug build crashes when printing ClassLoaderData
  • b7f75c0: 8271142: package help is not displayed for missing X11/extensions/Xrandr.h
  • e8a289e: 8272609: Add string deduplication support to SerialGC
  • b690f29: 8269687: pauth_aarch64.hpp include name is incorrect
  • f77a1a1: 8272472: StackGuardPages test doesn't build with glibc 2.34
  • 04a806e: 8270344: Session resumption errors
  • d85560e: 8267161: Write automated test case for JDK-4479161
  • 1ea437a: 8272720: Fix the implementation of loop unrolling heuristic with LoopPercentProfileLimit
  • ... and 380 more: https://git.openjdk.java.net/jdk/compare/a8f15427156b8095ee815fbe6ed14c25c1d4b374...master

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.

As you do not have Committer status in this project an existing Committer must agree to sponsor your change. Possible candidates are the reviewers of this PR (@dfuch) but any other Committer may sponsor as well.

➡️ To flag this PR as ready for integration with the above commit message, type /integrate in a new comment. (Afterwards, your sponsor types /sponsor in a new comment to perform the integration).

@openjdk openjdk bot added the ready Pull request is ready to be integrated label Aug 23, 2021
@fdesu
Copy link
Contributor Author

fdesu commented Aug 23, 2021

/integrate

@openjdk openjdk bot added the sponsor Pull request is ready to be sponsored label Aug 23, 2021
@openjdk
Copy link

openjdk bot commented Aug 23, 2021

@fdesu
Your change (at version 3991ea5) is now ready to be sponsored by a Committer.

@dfuch
Copy link
Member

dfuch commented Aug 24, 2021

/sponsor

@openjdk
Copy link

openjdk bot commented Aug 24, 2021

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

  • 94f5e44: 8271258: @param with non-ascii variable names produces incorrect results
  • 7454306: 8272526: Cleanup ThreadStateTransition class
  • 0597cde: 8221360: Eliminate Shared_DirtyCardQ_lock
  • 928b972: 8271930: Simplify end_card calculation in G1BlockOffsetTablePart::verify
  • 7f80683: 8272783: Epsilon: Refactor tests to improve performance
  • 22ef4f0: 5015261: NPE may be thrown if JDesktopIcon is set to null on a JInternalFrame
  • 9bc0232: 8269223: -Xcheck:jni WARNINGs working with fonts on Linux
  • 2ff4c01: 8271600: C2: CheckCastPP which should closely follow Allocate is sunk of a loop
  • ad92033: 8272736: [JVMCI] Add API for reading and writing JVMCI thread locals
  • 709b591: 8272553: several hotspot runtime/CommandLine tests don't check exit code
  • ... and 391 more: https://git.openjdk.java.net/jdk/compare/a8f15427156b8095ee815fbe6ed14c25c1d4b374...master

Your commit was automatically rebased without conflicts.

@openjdk openjdk bot closed this Aug 24, 2021
@openjdk openjdk bot added integrated Pull request has been integrated and removed ready Pull request is ready to be integrated rfr Pull request is ready for review sponsor Pull request is ready to be sponsored labels Aug 24, 2021
@openjdk
Copy link

openjdk bot commented Aug 24, 2021

@dfuch @fdesu Pushed as commit 2309b7d.

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

@fdesu fdesu deleted the remove-usages-of-linkedlist-in-netHttpFilterFactory branch August 24, 2021 15:48
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
2 participants