TRQ-2968 Lock and unlock the mutex around changing some elements in the hierarchy_handler class.