Java 类io.grpc.reflection.v1alpha.ListServiceResponse 实例源码

项目:grpc-java    文件:ProtoReflectionService.java   
private void listServices(ServerReflectionRequest request) {
  ListServiceResponse.Builder builder = ListServiceResponse.newBuilder();
  for (String serviceName : serverReflectionIndex.getServiceNames()) {
    builder.addService(ServiceResponse.newBuilder().setName(serviceName));
  }
  serverCallStreamObserver.onNext(
      ServerReflectionResponse.newBuilder()
          .setValidHost(request.getHost())
          .setOriginalRequest(request)
          .setListServicesResponse(builder)
          .build());
}
项目:polyglot    文件:ServerReflectionClient.java   
private void handleListServiceRespones(ListServiceResponse response) {
  ImmutableList.Builder<String> servicesBuilder = ImmutableList.builder();
  response.getServiceList().forEach(service -> servicesBuilder.add(service.getName()));
  resultFuture.set(servicesBuilder.build());
  requestStream.onCompleted();
}