Re-arrange code to avoid recursive locking of the JIT lock. am: 085f7408de am: f2b4ed391e

Change-Id: If5381a22978aa5a91ce278baceb85e83a92d4765