refactor graceful http shutdown