- java.lang.Object
-
- io.helidon.grpc.core.SafeStreamObserver<T>
-
- Type Parameters:
T
- the type of response expected
- All Implemented Interfaces:
io.grpc.stub.StreamObserver<T>
public class SafeStreamObserver<T> extends Object implements io.grpc.stub.StreamObserver<T>
AStreamObserver
that handles exceptions correctly.
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description io.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.void
onCompleted()
void
onError(Throwable thrown)
void
onNext(T t)
-
-
-
Method Detail
-
onError
public void onError(Throwable thrown)
- Specified by:
onError
in interfaceio.grpc.stub.StreamObserver<T>
-
onCompleted
public void onCompleted()
- Specified by:
onCompleted
in interfaceio.grpc.stub.StreamObserver<T>
-
delegate
public io.grpc.stub.StreamObserver<? super T> delegate()
Obtain the wrappedStreamObserver
.- Returns:
- the wrapped
StreamObserver
-
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
-
-