Class ProtoReflectionServiceV1.ProtoReflectionStreamObserver
- java.lang.Object
-
- io.grpc.protobuf.services.ProtoReflectionServiceV1.ProtoReflectionStreamObserver
-
- All Implemented Interfaces:
StreamObserver<ServerReflectionRequest>
,java.lang.Runnable
- Enclosing class:
- ProtoReflectionServiceV1
private static class ProtoReflectionServiceV1.ProtoReflectionStreamObserver extends java.lang.Object implements java.lang.Runnable, StreamObserver<ServerReflectionRequest>
-
-
Field Summary
Fields Modifier and Type Field Description private boolean
closeAfterSend
private ServerReflectionRequest
request
private ServerCallStreamObserver<ServerReflectionResponse>
serverCallStreamObserver
private ProtoReflectionServiceV1.ServerReflectionIndex
serverReflectionIndex
-
Constructor Summary
Constructors Constructor Description ProtoReflectionStreamObserver(ProtoReflectionServiceV1.ServerReflectionIndex serverReflectionIndex, ServerCallStreamObserver<ServerReflectionResponse> serverCallStreamObserver)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description private ServerReflectionResponse
createServerReflectionResponse(ServerReflectionRequest request, com.google.protobuf.Descriptors.FileDescriptor fd)
private void
getAllExtensions(ServerReflectionRequest request)
private void
getFileByExtension(ServerReflectionRequest request)
private void
getFileByName(ServerReflectionRequest request)
private void
getFileContainingSymbol(ServerReflectionRequest request)
private void
handleReflectionRequest()
private void
listServices(ServerReflectionRequest request)
void
onCompleted()
Receives a notification of successful stream completion.void
onError(java.lang.Throwable cause)
Receives a terminating error from the stream.void
onNext(ServerReflectionRequest request)
Receives a value from the stream.void
run()
private void
sendErrorResponse(ServerReflectionRequest request, Status.Code code, java.lang.String message)
-
-
-
Field Detail
-
serverReflectionIndex
private final ProtoReflectionServiceV1.ServerReflectionIndex serverReflectionIndex
-
serverCallStreamObserver
private final ServerCallStreamObserver<ServerReflectionResponse> serverCallStreamObserver
-
closeAfterSend
private boolean closeAfterSend
-
request
private ServerReflectionRequest request
-
-
Constructor Detail
-
ProtoReflectionStreamObserver
ProtoReflectionStreamObserver(ProtoReflectionServiceV1.ServerReflectionIndex serverReflectionIndex, ServerCallStreamObserver<ServerReflectionResponse> serverCallStreamObserver)
-
-
Method Detail
-
run
public void run()
- Specified by:
run
in interfacejava.lang.Runnable
-
onNext
public void onNext(ServerReflectionRequest request)
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<ServerReflectionRequest>
- Parameters:
request
- the value passed to the stream
-
handleReflectionRequest
private void handleReflectionRequest()
-
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<ServerReflectionRequest>
-
onError
public void onError(java.lang.Throwable cause)
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<ServerReflectionRequest>
- Parameters:
cause
- the error occurred on the stream
-
getFileByName
private void getFileByName(ServerReflectionRequest request)
-
getFileContainingSymbol
private void getFileContainingSymbol(ServerReflectionRequest request)
-
getFileByExtension
private void getFileByExtension(ServerReflectionRequest request)
-
getAllExtensions
private void getAllExtensions(ServerReflectionRequest request)
-
listServices
private void listServices(ServerReflectionRequest request)
-
sendErrorResponse
private void sendErrorResponse(ServerReflectionRequest request, Status.Code code, java.lang.String message)
-
createServerReflectionResponse
private ServerReflectionResponse createServerReflectionResponse(ServerReflectionRequest request, com.google.protobuf.Descriptors.FileDescriptor fd)
-
-