Hi!
Normally when I was using stubs I was creating ChannelImpl (by NettyChannelBuilder) and then when program ends I used channelImpl.shutdown(). Below is some code snippet for thath use case:
ChannelImpl channel = NettyChannelBuilder.<...>.build();
Service.ServiceStub stub = Service.newStub(channel);
...do some stuf with stub...
channel.shutdown(); // close channel and stub
Problem appears when I'm using interceptors. Method
ClientInterceptors.intercept(channel, interceptor) return
Channel (not
ChannelImpl) which hasn't any shutdown method.
ClientHeaderInterceptor<?> interceptor = interceptor();
Channel channel = ClientInterceptors.intercept(NettyChannelBuilder.<...>.build(), interceptor);
Service.ServiceStub stub = Service.newStub(channel);
...do some stuf with stub...
channel.shutdown(); // Error, Channel does not have shutdown method
stub.shutdown(); // Also errorIn my opinion stubs (normal, blocking and sync) should have method shutdown() to close them. Right now there is no way to end program.
FYI in RouteClient (from gRPC-java tutorials) you are also using approach with cloasing ChannelImpl.
Regards
Martin