StreamObserver
.-
Method Summary
Modifier and TypeMethodDescriptionstatic <T> void
Execute aRunnable
task and on completion of the task complete the gRPC request by callingStreamObserver.onNext(Object)
using the specified result and then callStreamObserver.onCompleted()
.static <T> void
Complete a gRPC request based on the result of aCallable
.static <T> void
complete
(io.grpc.stub.StreamObserver<T> observer, CompletionStage<T> future) Complete a gRPC request based on the result of aCompletionStage
.static <T> void
complete
(io.grpc.stub.StreamObserver<T> observer, T value) Complete a gRPC request.static <T> void
completeAsync
(io.grpc.stub.StreamObserver<T> observer, Runnable task, T result) Asynchronously execute aRunnable
task and on completion of the task complete the gRPC request by callingStreamObserver.onNext(Object)
using the specified result and then callStreamObserver.onCompleted()
.static <T> void
completeAsync
(io.grpc.stub.StreamObserver<T> observer, Runnable task, T result, Executor executor) Asynchronously execute aRunnable
task and on completion of the task complete the gRPC request by callingStreamObserver.onNext(Object)
using the specified result and then callStreamObserver.onCompleted()
.static <T> void
completeAsync
(io.grpc.stub.StreamObserver<T> observer, Callable<T> callable) Asynchronously complete a gRPC request based on the result of aCallable
.static <T> void
completeAsync
(io.grpc.stub.StreamObserver<T> observer, Callable<T> callable, Executor executor) Asynchronously complete a gRPC request based on the result of aCallable
.static <T> void
completeAsync
(io.grpc.stub.StreamObserver<T> observer, CompletionStage<T> future) Asynchronously complete a gRPC request based on the result of aCompletionStage
.static <T> void
completeAsync
(io.grpc.stub.StreamObserver<T> observer, CompletionStage<T> future, Executor executor) Asynchronously complete a gRPC request based on the result of aCompletionStage
.static <U> BiConsumer<Void,
Throwable> completeWithoutResult
(io.grpc.stub.StreamObserver<U> observer) Obtain aConsumer
that can be used to complete aStreamObserver
.static <T,
U> BiConsumer<T, Throwable> completeWithResult
(io.grpc.stub.StreamObserver<U> observer) Obtain aConsumer
that can be used to send values to theStreamObserver.onNext(Object)
method.static <T> Supplier<T>
createSupplier
(Callable<T> callable) static <T> Consumer<T>
stream
(io.grpc.stub.StreamObserver<T> observer, CompletionStage<Void> stage) Obtain aConsumer
that can be used to send values to theStreamObserver.onNext(Object)
method until theCompletionStage
completes then callStreamObserver.onCompleted()
.static <T> void
static <T> void
static <T> Consumer<T>
streamAsync
(io.grpc.stub.StreamObserver<T> observer, CompletionStage<Void> stage) Obtain aConsumer
that can be used to send values to theStreamObserver.onNext(Object)
method until theCompletionStage
completes then asynchronously callStreamObserver.onCompleted()
using the fork-join thread pool.static <T> Consumer<T>
streamAsync
(io.grpc.stub.StreamObserver<T> observer, CompletionStage<Void> stage, Executor executor) Obtain aConsumer
that can be used to send values to theStreamObserver.onNext(Object)
method until theCompletionStage
completes then asynchronously callStreamObserver.onCompleted()
using the executor thread.static <T> void
streamAsync
(io.grpc.stub.StreamObserver<T> observer, Supplier<Stream<? extends T>> supplier, Executor executor) static <T> void
streamAsync
(io.grpc.stub.StreamObserver<T> observer, Stream<? extends T> stream, Executor executor)
-
Method Details
-
complete
public static <T> void complete(io.grpc.stub.StreamObserver<T> observer, T value) Complete a gRPC request.The request will be completed by calling
StreamObserver.onNext(Object)
using the specified value then callingStreamObserver.onCompleted()
.- Type Parameters:
T
- they type of the request result- Parameters:
observer
- theStreamObserver
to completevalue
- the value to use when callingStreamObserver.onNext(Object)
-
complete
Complete a gRPC request based on the result of aCompletionStage
.The request will be completed by calling
StreamObserver.onNext(Object)
using the result obtained on completion of the specifiedCompletionStage
and then callingStreamObserver.onCompleted()
.If the
CompletionStage
completes with an error thenStreamObserver.onError(Throwable)
will be called.- Type Parameters:
T
- they type of the request result- Parameters:
observer
- theStreamObserver
to completefuture
- theCompletionStage
to use to obtain the value to use to callStreamObserver.onNext(Object)
-
completeAsync
public static <T> void completeAsync(io.grpc.stub.StreamObserver<T> observer, CompletionStage<T> future) Asynchronously complete a gRPC request based on the result of aCompletionStage
.The request will be completed by calling
StreamObserver.onNext(Object)
using the result obtained on completion of the specifiedCompletionStage
and then callingStreamObserver.onCompleted()
.If the
CompletionStage
completes with an error thenStreamObserver.onError(Throwable)
will be called.The execution will take place asynchronously on the fork-join thread pool.
- Type Parameters:
T
- they type of the request result- Parameters:
observer
- theStreamObserver
to completefuture
- theCompletionStage
to use to obtain the value to use to callStreamObserver.onNext(Object)
-
completeAsync
public static <T> void completeAsync(io.grpc.stub.StreamObserver<T> observer, CompletionStage<T> future, Executor executor) Asynchronously complete a gRPC request based on the result of aCompletionStage
.The request will be completed by calling
StreamObserver.onNext(Object)
using the result obtained on completion of the specifiedCompletionStage
and then callingStreamObserver.onCompleted()
.If the
CompletionStage
completes with an error thenStreamObserver.onError(Throwable)
will be called.- Type Parameters:
T
- they type of the request result- Parameters:
observer
- theStreamObserver
to completefuture
- theCompletionStage
to use to obtain the value to use to callStreamObserver.onNext(Object)
executor
- theExecutor
on which to execute the asynchronous request completion
-
complete
Complete a gRPC request based on the result of aCallable
.The request will be completed by calling
StreamObserver.onNext(Object)
using the result obtained on completion of the specifiedCallable
and then callingStreamObserver.onCompleted()
.If the
Callable.call()
method throws an exception thenStreamObserver.onError(Throwable)
will be called.- Type Parameters:
T
- they type of the request result- Parameters:
observer
- theStreamObserver
to completecallable
- theCallable
to use to obtain the value to use to callStreamObserver.onNext(Object)
-
completeAsync
Asynchronously complete a gRPC request based on the result of aCallable
.The request will be completed by calling
StreamObserver.onNext(Object)
using the result obtained on completion of the specifiedCallable
and then callingStreamObserver.onCompleted()
.If the
Callable.call()
method throws an exception thenStreamObserver.onError(Throwable)
will be called.The execution will take place asynchronously on the fork-join thread pool.
- Type Parameters:
T
- they type of the request result- Parameters:
observer
- theStreamObserver
to completecallable
- theCallable
to use to obtain the value to use to callStreamObserver.onNext(Object)
-
completeAsync
public static <T> void completeAsync(io.grpc.stub.StreamObserver<T> observer, Callable<T> callable, Executor executor) Asynchronously complete a gRPC request based on the result of aCallable
.The request will be completed by calling
StreamObserver.onNext(Object)
using the result obtained on completion of the specifiedCallable
and then callingStreamObserver.onCompleted()
.If the
Callable.call()
method throws an exception thenStreamObserver.onError(Throwable)
will be called. -
complete
Execute aRunnable
task and on completion of the task complete the gRPC request by callingStreamObserver.onNext(Object)
using the specified result and then callStreamObserver.onCompleted()
.If the
Runnable.run()
method throws an exception thenStreamObserver.onError(Throwable)
will be called.- Type Parameters:
T
- they type of the request result- Parameters:
observer
- theStreamObserver
to completetask
- theRunnable
to executeresult
- the result to pass toStreamObserver.onNext(Object)
-
completeAsync
public static <T> void completeAsync(io.grpc.stub.StreamObserver<T> observer, Runnable task, T result) Asynchronously execute aRunnable
task and on completion of the task complete the gRPC request by callingStreamObserver.onNext(Object)
using the specified result and then callStreamObserver.onCompleted()
.If the
Runnable.run()
method throws an exception thenStreamObserver.onError(Throwable)
will be called.The task and and request completion will be executed on the fork-join thread pool.
- Type Parameters:
T
- they type of the request result- Parameters:
observer
- theStreamObserver
to completetask
- theRunnable
to executeresult
- the result to pass toStreamObserver.onNext(Object)
-
completeAsync
public static <T> void completeAsync(io.grpc.stub.StreamObserver<T> observer, Runnable task, T result, Executor executor) Asynchronously execute aRunnable
task and on completion of the task complete the gRPC request by callingStreamObserver.onNext(Object)
using the specified result and then callStreamObserver.onCompleted()
.If the
Runnable.run()
method throws an exception thenStreamObserver.onError(Throwable)
will be called. -
stream
Send the values from aStream
to theStreamObserver.onNext(Object)
method until theStream
is exhausted callStreamObserver.onCompleted()
.If an error occurs whilst streaming results then
StreamObserver.onError(Throwable)
will be called.- Type Parameters:
T
- they type of the request result- Parameters:
observer
- theStreamObserver
to completestream
- theStream
of results to send toStreamObserver.onNext(Object)
-
streamAsync
public static <T> void streamAsync(io.grpc.stub.StreamObserver<T> observer, Stream<? extends T> stream, Executor executor) -
stream
public static <T> void stream(io.grpc.stub.StreamObserver<T> observer, Supplier<Stream<? extends T>> supplier) -
streamAsync
public static <T> void streamAsync(io.grpc.stub.StreamObserver<T> observer, Supplier<Stream<? extends T>> supplier, Executor executor) -
stream
public static <T> Consumer<T> stream(io.grpc.stub.StreamObserver<T> observer, CompletionStage<Void> stage) Obtain aConsumer
that can be used to send values to theStreamObserver.onNext(Object)
method until theCompletionStage
completes then callStreamObserver.onCompleted()
.If the
CompletionStage
completes with an error thenStreamObserver.onError(Throwable)
will be called instead ofStreamObserver.onCompleted()
.- Type Parameters:
T
- they type of the request result- Parameters:
observer
- theStreamObserver
to send values to and complete when theCompletionStage
completesstage
- theCompletionStage
to await completion of- Returns:
- a
Consumer
that can be used to send values to theStreamObserver.onNext(Object)
method
-
streamAsync
public static <T> Consumer<T> streamAsync(io.grpc.stub.StreamObserver<T> observer, CompletionStage<Void> stage) Obtain aConsumer
that can be used to send values to theStreamObserver.onNext(Object)
method until theCompletionStage
completes then asynchronously callStreamObserver.onCompleted()
using the fork-join thread pool.If the
CompletionStage
completes with an error thenStreamObserver.onError(Throwable)
will be called instead ofStreamObserver.onCompleted()
.- Type Parameters:
T
- they type of the request result- Parameters:
observer
- theStreamObserver
to send values to and complete when theCompletionStage
completesstage
- theCompletionStage
to await completion of- Returns:
- a
Consumer
that can be used to send values to theStreamObserver.onNext(Object)
method
-
streamAsync
public static <T> Consumer<T> streamAsync(io.grpc.stub.StreamObserver<T> observer, CompletionStage<Void> stage, Executor executor) Obtain aConsumer
that can be used to send values to theStreamObserver.onNext(Object)
method until theCompletionStage
completes then asynchronously callStreamObserver.onCompleted()
using the executor thread.If the
CompletionStage
completes with an error thenStreamObserver.onError(Throwable)
will be called instead ofStreamObserver.onCompleted()
.- Type Parameters:
T
- they type of the request result- Parameters:
observer
- theStreamObserver
to send values to and complete when theCompletionStage
completesstage
- theCompletionStage
to await completion ofexecutor
- theExecutor
on which to execute the asynchronous request completion- Returns:
- a
Consumer
that can be used to send values to theStreamObserver.onNext(Object)
method
-
completeWithResult
public static <T,U> BiConsumer<T,Throwable> completeWithResult(io.grpc.stub.StreamObserver<U> observer) Obtain aConsumer
that can be used to send values to theStreamObserver.onNext(Object)
method.- Type Parameters:
T
- the type of the resultU
- the type of the response- Parameters:
observer
- theStreamObserver
to complete- Returns:
- a
Consumer
that can be used to send values to theStreamObserver.onNext(Object)
method
-
completeWithoutResult
public static <U> BiConsumer<Void,Throwable> completeWithoutResult(io.grpc.stub.StreamObserver<U> observer) Obtain aConsumer
that can be used to complete aStreamObserver
.- Type Parameters:
U
- the type of the response- Parameters:
observer
- theStreamObserver
to complete- Returns:
- a
Consumer
that can be used to complete aStreamObserver
-
createSupplier
-