Single Argument Method Implementation.
class MyService extends AnExampleServiceGrpc.AnExampleServiceImplBase { @Override public void OneToOne ( AnExampleRequest request, io.grpc.stub.StreamObserver<AnExampleResponse> responseObserver) { // Method implementation goes here ... responseObserver.onNext (response); responseObserver.onCompleted (); } ... }
Server Initialization.
io.grpc.Server server = io.grpc.ServerBuilder .forPort (8888).addService (new MyService ()).build ().start (); server.awaitTermination ();
Uses static cached thread pool by default
Can use provided executor
Can use transport thread