Adding graceful shutdown apis