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

api: Clarify expectations regarding ServerCall#close #7580

Merged
merged 3 commits into from Nov 2, 2020
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
5 changes: 5 additions & 0 deletions api/src/main/java/io/grpc/ServerCall.java
Expand Up @@ -163,6 +163,11 @@ public boolean isReady() {
* <p>Since {@link Metadata} is not thread-safe, the caller must not access (read or write) {@code
* trailers} after this point.
*
* <p>Implementation note regarding ForwardingServerCalls: This method is called after the
Copy link
Member

Choose a reason for hiding this comment

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

I'd much rather not call out ForwardingServerCalls. And saying something like "this method won't be called" isn't right either as it is up to the application whether it is called or not.

I think we should have some text to emphasize that the close call is not the point where the RPC is complete. Instead, that is onComplete/onCancel. We can probably add that to the paragraph above. We can also say that close is not necessary to be called if the RPC is cancelled as the call is already dead.

* server completed the processing of the request, but before the response status is sent to the
* client, so the client is still able to cancel the request. This method won't be called for
* client side cancellations or errors.
*
* @throws IllegalStateException if call is already {@code close}d
*/
public abstract void close(Status status, Metadata trailers);
Expand Down