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
8253178: Replace LinkedList Impl in net.http.FilterFactory #4721
Conversation
|
Webrevs
|
|
||
public void addFilter(Class<? extends HeaderFilter> type) { | ||
filterClasses.add(type); | ||
} | ||
|
||
LinkedList<HeaderFilter> getFilterChain() { | ||
LinkedList<HeaderFilter> l = new LinkedList<>(); | ||
List<HeaderFilter> getFilterChain() { |
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 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?
31ab71b
to
3991ea5
Compare
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! |
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! |
Hi Sergei - I will have a look. It may take some time until I come back to you (my apologies). |
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. I can sponsor once you have integrated
.
@fdesu This change now passes all automated pre-integration checks. 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 390 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. 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.
|
/integrate |
/sponsor |
Going to push as commit 2309b7d.
Your commit was automatically rebased without conflicts. |
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
Issue
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