Make SafeKeyGenerator thread safe.