Making ServiceFactory thread safe.