File tree Expand file tree Collapse file tree
stub/src/main/java/io/grpc/stub Expand file tree Collapse file tree Original file line number Diff line number Diff line change 2020
2121/**
2222 * A refinement of {@link CallStreamObserver} that allows for lower-level interaction with
23- * client calls.
23+ * client calls. An instance of this class is obtained via {@link ClientResponseObserver}, or by
24+ * manually casting the {@code StreamObserver} returned by a stub.
2425 *
2526 * <p>Like {@code StreamObserver}, implementations are not required to be thread-safe; if multiple
2627 * threads will be writing to an instance concurrently, the application must synchronize its calls.
Original file line number Diff line number Diff line change 1818
1919/**
2020 * A refinement of {@link CallStreamObserver} to allows for interaction with call
21- * cancellation events on the server side.
21+ * cancellation events on the server side. An instance of this class is obtained by casting the
22+ * {@code StreamObserver} passed as an argument to service implementations.
2223 *
2324 * <p>Like {@code StreamObserver}, implementations are not required to be thread-safe; if multiple
2425 * threads will be writing to an instance concurrently, the application must synchronize its calls.
Original file line number Diff line number Diff line change 3131 * not need to be synchronized together; incoming and outgoing directions are independent.
3232 * Since individual {@code StreamObserver}s are not thread-safe, if multiple threads will be
3333 * writing to a {@code StreamObserver} concurrently, the application must synchronize calls.
34+ *
35+ * <p>This API is asynchronous, so methods may return before the operation completes. The API
36+ * provides no guarantees for how quickly an operation will complete, so utilizing flow control via
37+ * {@link ClientCallStreamObserver} and {@link ServerCallStreamObserver} to avoid excessive
38+ * buffering is recommended for streaming RPCs. gRPC's implementation of {@code onError()} on
39+ * client-side causes the RPC to be cancelled and discards all messages, so completes quickly.
40+ *
41+ * <p>gRPC guarantees it does not block on I/O in its implementation, but applications are allowed
42+ * to perform blocking operations in their implementations. However, doing so will delay other
43+ * callbacks because the methods cannot be called concurrently.
3444 */
3545public interface StreamObserver <V > {
3646 /**
You can’t perform that action at this time.
0 commit comments