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 booleancloseAfterSendprivate ServerReflectionRequestrequestprivate ServerCallStreamObserver<ServerReflectionResponse>serverCallStreamObserverprivate ProtoReflectionServiceV1.ServerReflectionIndexserverReflectionIndex
-
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 ServerReflectionResponsecreateServerReflectionResponse(ServerReflectionRequest request, com.google.protobuf.Descriptors.FileDescriptor fd)private voidgetAllExtensions(ServerReflectionRequest request)private voidgetFileByExtension(ServerReflectionRequest request)private voidgetFileByName(ServerReflectionRequest request)private voidgetFileContainingSymbol(ServerReflectionRequest request)private voidhandleReflectionRequest()private voidlistServices(ServerReflectionRequest request)voidonCompleted()Receives a notification of successful stream completion.voidonError(java.lang.Throwable cause)Receives a terminating error from the stream.voidonNext(ServerReflectionRequest request)Receives a value from the stream.voidrun()private voidsendErrorResponse(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:
runin interfacejava.lang.Runnable
-
onNext
public void onNext(ServerReflectionRequest request)
Description copied from interface:StreamObserverReceives 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:
onNextin interfaceStreamObserver<ServerReflectionRequest>- Parameters:
request- the value passed to the stream
-
handleReflectionRequest
private void handleReflectionRequest()
-
onCompleted
public void onCompleted()
Description copied from interface:StreamObserverReceives 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
onCompletedno further calls to any method are allowed.- Specified by:
onCompletedin interfaceStreamObserver<ServerReflectionRequest>
-
onError
public void onError(java.lang.Throwable cause)
Description copied from interface:StreamObserverReceives 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
onErrorno further calls to any method are allowed.tshould be aStatusExceptionorStatusRuntimeException, but otherThrowabletypes are possible. Callers should generally convert from aStatusviaStatus.asException()orStatus.asRuntimeException(). Implementations should generally convert to aStatusviaStatus.fromThrowable(Throwable).- Specified by:
onErrorin 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)
-
-