QA-5805: Addressed improper usage of double-locked checking idiom.