Modified code to ensure a consistent shutworn to avoid YARN-1944,
Decoupled Emulator code from real thing for both Application Master and Application Container,
Minor cleanup in preparation for hooking up a distributed Thread pool.