Fix possible data race condition

This issue was found by scan.coverity.com (CID 19961)
which is a static code analysis tool, free for open source
code.

Assuming we have two threads both can pass the !ready
condition before entering the critical section protected with
"synchronized (dataDir)". So theoretically both threads will
arrive at setting ready to true.

Change-Id: I4b833279d755b32e4b1e0817cca5584c21c6346a
1 file changed