@Override
    public StreamObserver<HelloRequest> lotsOfGreetings(StreamObserver<HelloReply> responseObserver) {
        return new StreamObserver<HelloRequest>() {
            final ArrayList<String> names = new ArrayList<>();

            @Override
            public void onNext(HelloRequest value) {
                names.add(value.getName());
            }

            @Override
            public void onError(Throwable t) {
                responseObserver.onError(t);
            }

            @Override
            public void onCompleted() {
                responseObserver.onNext(buildReply(toMessage(String.join(", ", names))));
                responseObserver.onCompleted();
            }
        };
    }
@ Override public StreamObserver < HelloRequest > lotsOfGreetings ( StreamObserver < HelloReply > responseObserver ) { return new StreamObserver < HelloRequest > ( ) { final ArrayList < String > names = new ArrayList < > ( ) ; @ Override public void onNext ( HelloRequest value ) { names . add ( value . getName ( ) ) ; } @ Override public void onError ( Throwable t ) { responseObserver . onError ( t ) ; } @ Override public void onCompleted ( ) { responseObserver . onNext ( buildReply ( toMessage ( String . join ( ", " , names ) ) ) ) ; responseObserver . onCompleted ( ) ; } } ; }
Sends a {@link HelloReply} when a request has been completed with multiple {@link HelloRequest}s.