add graceful_exit demo codes