You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to grpc.io
I am using grpc-java. Let us say I have created a Service (ServiceImpl), added few services and started the service.
Now if I want to graceful shutdown, do I have first call shutdown on each of the services added to ServiceImpl and then follow-it with a call to service.shutdown?
or service.shutdown will handle both the cases?
Thanks,
Eric Anderson
unread,
Dec 7, 2017, 3:45:03 PM12/7/17
Reply to author
Sign in to reply to author
Forward
Sign in to forward
Delete
You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
Now if I want to graceful shutdown, do I have first call shutdown on each of the services added to ServiceImpl and then follow-it with a call to service.shutdown?
or service.shutdown will handle both the cases?
There isn't a `service.shutdown()`, just server (unless you made it, and then I won't know what it does). I think you should do things in the opposite order: first shut down the server, then the services.
I'd expect the normal flow to be:
server.shutdown(); // This simply prevents new RPCs
server.awaitTermination(5, SECONDS); // This is the grace time
server.shutdownNow(); // This kills all RPCs
// This needs some time to queue cancellation notifications.
// Note that terminated does not imply the application is done processing.
// It only means the server won't issue any more work to the application.
if (!server.awaitTermination(1, SECONDS)) {
log.log(WARNING, "For some reason the server didn't shutdown promptly");
}
// After the server is terminated, all work has at least been queued onto the server's executor.
// You can shutdown and wait on that executor if you want. You can then also clean up services.
cleanUpServices();
Rama Rao
unread,
Dec 7, 2017, 4:02:21 PM12/7/17
Reply to author
Sign in to reply to author
Forward
Sign in to forward
Delete
You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to Eric Anderson, grpc.io
Thanks, Yeah, my main question was around whether server,shutdown can be called before we cleanup the services. Your answer helps.