diff --git a/stub/src/main/java/io/grpc/stub/ClientCalls.java b/stub/src/main/java/io/grpc/stub/ClientCalls.java index ff2804a0a1f..5fcb1d42d78 100644 --- a/stub/src/main/java/io/grpc/stub/ClientCalls.java +++ b/stub/src/main/java/io/grpc/stub/ClientCalls.java @@ -77,6 +77,12 @@ private ClientCalls() {} * *
If the provided {@code responseObserver} is an instance of {@link ClientResponseObserver}, * {@code beforeStart()} will be called. + * + *
If the provided {@code responseObserver} is an instance of {@link ClientResponseObserver}, * {@code beforeStart()} will be called. + * + *
If the provided {@code responseObserver} is an instance of {@link ClientResponseObserver}, * {@code beforeStart()} will be called. * + *
If the provided {@code responseObserver} is an instance of {@link ClientResponseObserver}, * {@code beforeStart()} will be called. * + *
The returned iterator may throw {@link StatusRuntimeException} on error. + *
The returned iterator may throw {@link StatusRuntimeException} on error. + *
Warning: the iterator can result in leaks if not completely consumed.
*
@@ -242,6 +312,13 @@ public static The methods {@link BlockingClientCall#hasNext()} and {@link
* BlockingClientCall#cancel(String, Throwable)} can be used for more extensive control.
*
+ * Server errors
+ * If the server completes the RPC with a non-OK status, the returned {@link BlockingClientCall}
+ * will throw a {@link StatusException} when calling read or write operations (e.g.,
+ * {@link BlockingClientCall#read()}, {@link BlockingClientCall#hasNext()}, or
+ * {@link BlockingClientCall#write(Object)}). The status code and trailers can be accessed from
+ * the exception.
+ *
* @return A {@link BlockingClientCall} that has had the request sent and halfClose called
*/
@ExperimentalApi("https://github.com/grpc/grpc-java/issues/10918")
@@ -280,6 +357,13 @@ public static Server errors
+ * If the server completes the RPC with a non-OK status, the returned {@link BlockingClientCall}
+ * will throw a {@link StatusException} when calling read or write operations (e.g.,
+ * {@link BlockingClientCall#read()}, {@link BlockingClientCall#hasNext()}, or
+ * {@link BlockingClientCall#write(Object)}). The status code and trailers can be accessed from
+ * the exception.
+ *
* @return A {@link BlockingClientCall} which can be used by the client to write and receive
* messages over the grpc channel.
*/
@@ -294,6 +378,13 @@ public static Server errors
+ * If the server completes the RPC with a non-OK status, the returned {@link BlockingClientCall}
+ * will throw a {@link StatusException} when calling read or write operations (e.g.,
+ * {@link BlockingClientCall#read()}, {@link BlockingClientCall#hasNext()}, or
+ * {@link BlockingClientCall#write(Object)}). The status code and trailers can be accessed from
+ * the exception.
+ *
* @return an object representing the call which can be used to read, write and terminate it.
*/
@ExperimentalApi("https://github.com/grpc/grpc-java/issues/10918")
@@ -316,6 +407,11 @@ public static Server errors
+ * If the server completes the RPC with a non-OK status, the returned future will fail with
+ * a {@link StatusRuntimeException}. The status code and trailers can be accessed from the
+ * exception.
+ *
* @return a future for the single response message.
*/
public static Client errors
+ * The Throwable received by the server's request stream observer when converted to a status
+ * with Status.fromThrowable(), always has the status code CANCELLED.
+ *
+ * @param responseObserver the observer to receive the single response. Calling {@code
+ * responseObserver}'s {@link StreamObserver#onCompleted} or {@link
+ * StreamObserver#onError} is the end of the RPC. {@code onCompleted()} will close the RPC
+ * with status code OK. {@code onError()} will convert the Throwable to a Status with {@link
+ * Status#fromThrowable} and trailers with {@link Status#trailersFromThrowable}. The {@link
+ * Status#getCause} is not sent to the client, except if done by an interceptor. Callers
+ * generally create a Throwable with {@link Status#asException()}, {@link
+ * Status#asException(Metadata)}, {@link Status#asRuntimeException()}, or {@link
+ * Status#asRuntimeException(Metadata)}.
+ * @return a stream observer for receiving the request stream from the client
+ */
@Override StreamObserverClient errors
+ * The Throwable received by the server's request stream observer when converted to a status
+ * with Status.fromThrowable(), always has the status code CANCELLED.
+ *
+ * @param responseObserver the observer to receive the response stream. Calling {@code
+ * responseObserver}'s {@link StreamObserver#onCompleted} or {@link
+ * StreamObserver#onError} is the end of the RPC. {@code onCompleted()} will close the RPC
+ * with status code OK. {@code onError()} will convert the Throwable to a Status with {@link
+ * Status#fromThrowable} and trailers with {@link Status#trailersFromThrowable}. The {@link
+ * Status#getCause} is not sent to the client, except if done by an interceptor. Callers
+ * generally create a Throwable with {@link Status#asException()}, {@link
+ * Status#asException(Metadata)}, {@link Status#asRuntimeException()}, or {@link
+ * Status#asRuntimeException(Metadata)}.
+ * @return a stream observer for receiving the request stream from the client
+ */
@Override StreamObserver