Skip to content

Commit d27cbc8

Browse files
committed
Improve docs to describe close as being last method called
This isn't changing any of the semantics we already had, but more informing users of the guarantees we provide.
1 parent 7fff088 commit d27cbc8

2 files changed

Lines changed: 13 additions & 10 deletions

File tree

core/src/main/java/io/grpc/ClientCall.java

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -80,10 +80,13 @@ public abstract static class Listener<T> {
8080
public abstract void onPayload(T payload);
8181

8282
/**
83-
* The ClientCall has been closed. No further sending or receiving can occur. If {@code status}
84-
* is not equal to {@link Status#OK}, then the call failed. An additional block of trailer
85-
* metadata may be received at the end of the call from the server. An empty {@link Metadata}
86-
* object is passed if no trailers are received.
83+
* The ClientCall has been closed. Any additional calls to the {@code ClientCall} will not be
84+
* processed by the server. No further receiving will occur and no further notifications will be
85+
* made.
86+
*
87+
* <p>If {@code status} is not equal to {@link Status#OK}, then the call failed. An additional
88+
* block of trailer metadata may be received at the end of the call from the server. An empty
89+
* {@link Metadata} object is passed if no trailers are received.
8790
*
8891
* @param status the result of the remote call.
8992
* @param trailers metadata provided at call completion.

stub/src/main/java/io/grpc/stub/StreamObserver.java

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -60,9 +60,9 @@ public interface StreamObserver<V> {
6060
/**
6161
* Receives a terminating error from the stream.
6262
*
63-
* <p>May only be called once and is never called after {@link #onCompleted()}. In particular if
64-
* an exception is thrown by an implementation of {@code onError} no further calls to any
65-
* method are allowed.
63+
* <p>May only be called once and if called it must be the last method called. In particular if an
64+
* exception is thrown by an implementation of {@code onError} no further calls to any method are
65+
* allowed.
6666
*
6767
* @param t the error occurred on the stream
6868
*/
@@ -71,9 +71,9 @@ public interface StreamObserver<V> {
7171
/**
7272
* Receives a notification of successful stream completion.
7373
*
74-
* <p>May only be called once and is never called after {@link #onError(Throwable)}. In particular
75-
* if an exception is thrown by an implementation of {@code onCompleted} no further calls to
76-
* any method are allowed.
74+
* <p>May only be called once and if called it must be the last method called. In particular if an
75+
* exception is thrown by an implementation of {@code onCompleted} no further calls to any method
76+
* are allowed.
7777
*/
7878
public void onCompleted();
7979
}

0 commit comments

Comments
 (0)