fix for #3090 and #3091

Cause of these issues is that there can be a **synchronization problem** for initializing **attribute type** and using **attribute type** for converting searched value.

**Note:** I could only reproduced this issue with stabilizer (not unit test) with settings mentioned by @Danny-Hazelcast and after this fix, I couldn't see these error never again with diffirent instance, client and worker counts for 30 test executions.

~~~~
Cluster profile: Medium
Stabilizer test: com.hazelcast.stabilizer.tests.map.MapIndexTest,
Hazelcast version: 3.3-RC3
~~~~

Without synchronization around **attribute type**, **Thread-1** can see **attribute type** as **null** since there is no added index and doesn't convert searched value so uses it as raw (String). Then this thread may be **deactivated**, another thread (**Thread-2**) may take a change to run for saving an index and updates **attribute type**. Then **Thread-1** may be **activated** again and iterates over records on index store. In this case, **Thread-1** didn't convert searched value to expected value type and iteration over indexed elements can cause **class cast exception**. To handle this case, synchronization is implemented with **locks** around **attribute type**.
      
In addition, all methods converting searched values and saving index can be defined as **synchronized** and this technique solves the issue, but I think this is **not an efficient way** to making synchronized for all cases since synchronization is required only when attribute type is null. Because in that case, there is no metadata to convert searched value.
Always place the lock outside of the try/finally. In theory it can happen that the lock is not acquired, and then you do the release. Apart from that, it also is bad style :)