Package com.oracle.coherence.client
Class SingleValueStreamObserver<T>
- java.lang.Object
-
- com.oracle.coherence.client.SingleValueStreamObserver<T>
-
- Type Parameters:
T- The type of objects received in this stream.
- All Implemented Interfaces:
io.grpc.stub.StreamObserver<T>
public class SingleValueStreamObserver<T> extends Object implements io.grpc.stub.StreamObserver<T>
A simpleStreamObserveradapter class that completes aCompletableFuturewhen the observer is completed.This observer uses the value passed to its
onNext(Object)method to complete theCompletableFuture.This observer should only be used in cases where a single result is expected. If more that one call is made to
onNext(Object)then future will be completed with an exception.- Since:
- 20.06
- Author:
- Jonathan Knight 2020.09.21
-
-
Constructor Summary
Constructors Constructor Description SingleValueStreamObserver()Create a SingleValueStreamObserver.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description CompletionStage<T>completionStage()Obtain theCompletableFuturethat will be completed when theStreamObservercompletes.voidonCompleted()voidonError(Throwable t)voidonNext(T value)
-
-
-
Method Detail
-
onNext
public void onNext(T value)
- Specified by:
onNextin interfaceio.grpc.stub.StreamObserver<T>
-
onError
public void onError(Throwable t)
- Specified by:
onErrorin interfaceio.grpc.stub.StreamObserver<T>
-
onCompleted
public void onCompleted()
- Specified by:
onCompletedin interfaceio.grpc.stub.StreamObserver<T>
-
completionStage
public CompletionStage<T> completionStage()
Obtain theCompletableFuturethat will be completed when theStreamObservercompletes.- Returns:
- The CompletableFuture
-
-