Fix synchronization when preparing ids.

Synchronized blocks were using different locks.
Replaced by a safer version: marking intern method synchronized.
This means synchronizing more than necessary but it had no
mesurable perfomance impact.

Bug 11744785

Change-Id: I35e691232cd6971d13735be9b72969739ef71e09
(cherry picked from commit 5c4883e75b26a002c67bfa1c0053c50e17dbac90)
4 files changed