Class ServerCalls.NoopStreamObserver<V>
- java.lang.Object
-
- io.grpc.stub.ServerCalls.NoopStreamObserver<V>
-
- All Implemented Interfaces:
StreamObserver<V>
- Enclosing class:
- ServerCalls
static class ServerCalls.NoopStreamObserver<V> extends java.lang.Object implements StreamObserver<V>
No-op implementation of StreamObserver. Used in abstract stubs for default implementations of methods which throws UNIMPLEMENTED error and tests.
-
-
Constructor Summary
Constructors Constructor Description NoopStreamObserver()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
onCompleted()
Receives a notification of successful stream completion.void
onError(java.lang.Throwable t)
Receives a terminating error from the stream.void
onNext(V value)
Receives a value from the stream.
-
-
-
Method Detail
-
onNext
public void onNext(V value)
Description copied from interface:StreamObserver
Receives a value from the stream.Can be called many times but is never called after
StreamObserver.onError(Throwable)
orStreamObserver.onCompleted()
are called.Unary calls must invoke onNext at most once. Clients may invoke onNext at most once for server streaming calls, but may receive many onNext callbacks. Servers may invoke onNext at most once for client streaming calls, but may receive many onNext callbacks.
If an exception is thrown by an implementation the caller is expected to terminate the stream by calling
StreamObserver.onError(Throwable)
with the caught exception prior to propagating it.- Specified by:
onNext
in interfaceStreamObserver<V>
- Parameters:
value
- the value passed to the stream
-
onError
public void onError(java.lang.Throwable t)
Description copied from interface:StreamObserver
Receives a terminating error from the stream.May only be called once and if called it must be the last method called. In particular if an exception is thrown by an implementation of
onError
no further calls to any method are allowed.t
should be aStatusException
orStatusRuntimeException
, but otherThrowable
types are possible. Callers should generally convert from aStatus
viaStatus.asException()
orStatus.asRuntimeException()
. Implementations should generally convert to aStatus
viaStatus.fromThrowable(Throwable)
.- Specified by:
onError
in interfaceStreamObserver<V>
- Parameters:
t
- the error occurred on the stream
-
onCompleted
public void onCompleted()
Description copied from interface:StreamObserver
Receives a notification of successful stream completion.May only be called once and if called it must be the last method called. In particular if an exception is thrown by an implementation of
onCompleted
no further calls to any method are allowed.- Specified by:
onCompleted
in interfaceStreamObserver<V>
-
-