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

static method StreamObservers.nextAndComplete() #11778

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 18 additions & 4 deletions stub/src/main/java/io/grpc/stub/StreamObservers.java
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,20 @@
/**
* Utility functions for working with {@link StreamObserver} and it's common subclasses like
* {@link CallStreamObserver}.
*
* @deprecated Of questionable utility and generally not used.
*/
@Deprecated
@ExperimentalApi("https://github.com/grpc/grpc-java/issues/4694")
public final class StreamObservers {
/**
* Utility method to call {@link StreamObserver#onNext(Object)} and
* {@link StreamObserver#onCompleted()} on the specified responseObserver.
*/
@ExperimentalApi("https://github.com/grpc/grpc-java/issues/10957")
public static <T> void nextAndComplete(StreamObserver<T> responseObserver, T response) {
Preconditions.checkNotNull(response, "response");

Check warning on line 34 in stub/src/main/java/io/grpc/stub/StreamObservers.java

View check run for this annotation

Codecov / codecov/patch

stub/src/main/java/io/grpc/stub/StreamObservers.java#L34

Added line #L34 was not covered by tests

responseObserver.onNext(response);
responseObserver.onCompleted();
}

Check warning on line 38 in stub/src/main/java/io/grpc/stub/StreamObservers.java

View check run for this annotation

Codecov / codecov/patch

stub/src/main/java/io/grpc/stub/StreamObservers.java#L36-L38

Added lines #L36 - L38 were not covered by tests

/**
* Copy the values of an {@link Iterator} to the target {@link CallStreamObserver} while properly
* accounting for outbound flow-control. After calling this method, {@code target} should no
Expand All @@ -40,7 +48,10 @@
*
* @param source of values expressed as an {@link Iterator}.
* @param target {@link CallStreamObserver} which accepts values from the source.
* @deprecated Of questionable utility and generally not used.
*/
@Deprecated
@ExperimentalApi("https://github.com/grpc/grpc-java/issues/4694")
public static <V> void copyWithFlowControl(final Iterator<V> source,
final CallStreamObserver<V> target) {
Preconditions.checkNotNull(source, "source");
Expand Down Expand Up @@ -80,7 +91,10 @@
*
* @param source of values expressed as an {@link Iterable}.
* @param target {@link CallStreamObserver} which accepts values from the source.
* @deprecated Of questionable utility and generally not used.
*/
@Deprecated
@ExperimentalApi("https://github.com/grpc/grpc-java/issues/4694")
public static <V> void copyWithFlowControl(final Iterable<V> source,
CallStreamObserver<V> target) {
Preconditions.checkNotNull(source, "source");
Expand Down
Loading