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

Issue #10547 - Allow Executor of WebSocketClient to be customized via HttpClient #10548

Merged
merged 3 commits into from
Sep 22, 2023

Conversation

joakime
Copy link
Contributor

@joakime joakime commented Sep 19, 2023

Add ability of WebSocketClient to pull Executor and ByteBufferPool from configured HttpClient

@joakime joakime added the Bug For general bugs on Jetty side label Sep 19, 2023
@joakime joakime added this to the 10.0.x milestone Sep 19, 2023
@joakime joakime requested review from gregw, sbordet and lorban September 19, 2023 13:32
@joakime joakime self-assigned this Sep 19, 2023
@joakime joakime linked an issue Sep 19, 2023 that may be closed by this pull request
Signed-off-by: Joakim Erdfelt <[email protected]>
@joakime joakime requested a review from lorban September 19, 2023 14:00
lorban
lorban previously approved these changes Sep 19, 2023
@lorban
Copy link
Contributor

lorban commented Sep 19, 2023

LGTM but please note that the issue was originally reported for Jetty 10.0.x.

Don't you want to do this change on the jetty-10.0.x branch then merge it forward?

@joakime
Copy link
Contributor Author

joakime commented Sep 19, 2023

LGTM but please note that the issue was originally reported for Jetty 10.0.x.

Don't you want to do this change on the jetty-10.0.x branch then merge it forward?

This is the jetty-10.0.x branch.
What are you seeing?

@lorban
Copy link
Contributor

lorban commented Sep 19, 2023

I could swear I saw this PR made against 12.0.x. Either I dreamt it or GitHub was drunk.

@joakime joakime added the Sponsored This issue affects a user with a commercial support agreement label Sep 19, 2023
Copy link
Contributor

@lachlan-roberts lachlan-roberts left a comment

Choose a reason for hiding this comment

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

LGTM, just an issue with the the javadoc.

Copy link
Contributor

@gregw gregw left a comment

Choose a reason for hiding this comment

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

The change is good... but I don't like some of pre-existing stuff I see.
I'm not keen on how there is both a ThreadPool and an Executor in the WebSocketComponents.

Ideally we should just pass one and derive the other from it (up or down caste). If they really REALLY can be different, then it needs to be javadoc'd what each is used for and how they relate.

So, whilst only tangential to this PR, can you add some javadoc about that?

@joakime
Copy link
Contributor Author

joakime commented Sep 20, 2023

The change is good... but I don't like some of pre-existing stuff I see.

Sounds like we need a new Issue about it.

I'm not keen on how there is both a ThreadPool and an Executor in the WebSocketComponents.

There's only an Executor in WebSocketComponents.
The QueuedThreadPool you see is the default implementation if an Executor is null.

Ideally we should just pass one and derive the other from it (up or down caste). If they really REALLY can be different, then it needs to be javadoc'd what each is used for and how they relate.

There's an Executor in WebSocketComponents, and an Executor in HttpClient.
For purposes of WebSocket / WebSocketClient the WebSocketComponents executor is used.
For purposes of HTTP, the HttpClient executor one is used.
If you give WebSocketClient an unstarted and/or unconfigured HttpClient, then the Executor on the HttpClient is populated from the WebSocketComponents.

So, whilst only tangential to this PR, can you add some javadoc about that?

That seems complicated and is documenting code / internal behaviors, I don't see that as appropriate for an API doc (once documented, we cannot change the internal behaviors).

Signed-off-by: Joakim Erdfelt <[email protected]>
@gregw
Copy link
Contributor

gregw commented Sep 20, 2023

That seems complicated and is documenting code / internal behaviors, I don't see that as appropriate for an API doc (once documented, we cannot change the internal behaviors).

I don't understand how to use this class, so the javadoc is for people like me.
@lachlan-roberts can you say how the usage of the threadpool vs the executor differ?

@joakime
Copy link
Contributor Author

joakime commented Sep 20, 2023

@lachlan-roberts can you say how the usage of the threadpool vs the executor differ?

@gregw where do you see threadpool and executor in the same class?

@lachlan-roberts
Copy link
Contributor

@gregw I think we never needed to use any methods of ThreadPool in websocket except execute(). So WebSocketComponents just provides an Executor instead of a ThreadPool.

In the ServerWebSocketComponents we use the servers ThreadPool for this.

@joakime joakime merged commit 50a1b31 into jetty-10.0.x Sep 22, 2023
@joakime joakime deleted the fix/10.0.x/websocket-client-executor branch September 22, 2023 12:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug For general bugs on Jetty side Sponsored This issue affects a user with a commercial support agreement
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Cannot customize Executor on WebSocketClient
4 participants