Thread-safe singleton implementation.

Change-Id: I0003d478c401636979f4f03bd0b2bc94e150562c