HPCC-8631 Changes for thread safety

Added singleton lock.
Added MODULE_INIT/MODULE_EXIT to handle object creation and destruction.

Signed-off-by: Philip Schwartz <philip.schwartz@lexisnexis.com>