Package com.oracle.coherence.grpc
Class SafeStreamObserver<T>
java.lang.Object
com.oracle.coherence.grpc.SafeStreamObserver<T>
- Type Parameters:
T
- the type of response expected
- All Implemented Interfaces:
io.grpc.stub.StreamObserver<T>
A
StreamObserver
that handles exceptions correctly.- Author:
- Jonathan Knight 2020.09.22
-
Method Summary
Modifier and TypeMethodDescriptionio.grpc.stub.StreamObserver
<? super T> delegate()
Obtain the wrappedStreamObserver
.static <T> io.grpc.stub.StreamObserver
<T> ensureSafeObserver
(io.grpc.stub.StreamObserver<T> observer) Ensure that the specifiedStreamObserver
is a safe observer.boolean
isDone()
Returnstrue
if this observer is complete.void
void
void
whenDone()
-
Method Details
-
onNext
- Specified by:
onNext
in interfaceio.grpc.stub.StreamObserver<T>
-
onError
- Specified by:
onError
in interfaceio.grpc.stub.StreamObserver<T>
-
onCompleted
public void onCompleted()- Specified by:
onCompleted
in interfaceio.grpc.stub.StreamObserver<T>
-
delegate
Obtain the wrappedStreamObserver
.- Returns:
- the wrapped
StreamObserver
-
isDone
public boolean isDone()Returnstrue
if this observer is complete.- Returns:
true
if this observer is complete
-
whenDone
-
ensureSafeObserver
public static <T> io.grpc.stub.StreamObserver<T> ensureSafeObserver(io.grpc.stub.StreamObserver<T> observer) Ensure that the specifiedStreamObserver
is a safe observer.If the specified observer is not an instance of
SafeStreamObserver
then wrap it in aSafeStreamObserver
.- Type Parameters:
T
- the response type expected by the observer- Parameters:
observer
- theStreamObserver
to test- Returns:
- a safe
StreamObserver
-