Ensure dist runtime is in sync before shutting down. (#5714)
* added the new dist runtime class.
* convert the class to singleton
* the tests passed.
* cleaned up
* fix a build error
* Use std::call_once. But it results in early shutting down the dist rt service before the job finishes.
* Revert "Use std::call_once. But it results in early shutting down the dist rt service before the job finishes."
This reverts commit d6e2b98ae0e98d7214deb915368db5cf029765c2.
* fix comments
* fix comment