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

Make Client's Request and Response abort() fully async #8725

Merged
merged 5 commits into from
Oct 21, 2022

Conversation

lorban
Copy link
Contributor

@lorban lorban commented Oct 18, 2022

The client's Request and Response interfaces contain the following method:

boolean abort(Throwable cause);

The contract of that abort() method is to asynchronously notify a running request that it has to be aborted.

That abort() method is meant to run concurrently with the servicing of the request, meaning that the request may be aborted, or it may finish before the abort takes effect, and some actions must happen depending on the outcome of this race condition: either abort() won the race and -for instance in H2- a reset needs to be sent, or abort() lost the race and it basically must be treated as a no-op.

The problem of the current method signature is that it returns a boolean that is returned immediately while that boolean is supposed to be computed during the async execution. This has hard implications on how abort() can be implemented, and prevents some refactorings of the client's internals.

The solution is to change the contract such as the boolean is delivered asynchronously:

CompletableFuture<Boolean> abort(Throwable cause);

… CompletableFuture<Boolean>

Signed-off-by: Ludovic Orban <[email protected]>
Signed-off-by: Ludovic Orban <[email protected]>
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.

Can you provide a description for the PR, perhaps suggesting which of the 40 files contains the core of the changes.

@lorban lorban changed the title Make Request and Response abort() fully async Make Client's Request and Response abort() fully async Oct 19, 2022
Signed-off-by: Ludovic Orban <[email protected]>
Signed-off-by: Ludovic Orban <[email protected]>
@sbordet sbordet self-requested a review October 21, 2022 13:31
Signed-off-by: Ludovic Orban <[email protected]>
@lorban lorban merged commit 38289e4 into jetty-12.0.x Oct 21, 2022
@lorban lorban deleted the jetty-12.0.x-review-client-request-abort branch October 21, 2022 13:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants