android google should - Synchronize(“Cache_Group”) part gets skipped , why is it so?
First thing that comes to mind is that sychronizing on a string is useless.
sychronized locks access to a block based on the given reference not the value. Using a "String" defeats this purpose because strings are immutable and calling synchronized("Cache_Group") twice will construct 2 strings with 2 different references, allowing the second iteration to break the intended lock.
EDIT: @see ReentrantLock for better access control
I am trying to figure out that my synchronize("Group_Name") gets skipped if I try to sync different values through it , why is it so .
Consider the following issue .
I have a SyncGroup named - "Group1" in which I have a MBO named "MBOGroup1" in which I have attributes "name" , "password" , "codeCheck" . I fetch data and extract on attribute as "releaseCode"
Now I have another SyncGroup named - "GroupSub1" in which I have a MBO named "MBOSubGroup1" in which I pass attributes "releaseCode" I get some result .
The condition is as follows
If I get multiple rows for "MBOGroup1" , I put a for loop for "GroupSub1" and pass each "releaseCode" data to "GroupSub1" and extract result
Most of the times it happens that some releaseCode gets skipped and I get incorrect "result" for "GroupSub1" why is it so ?? Is it due to for loop executing faster than synchronize() word or something else like CacheGroup Policies as OnDemand and time as 10seconds
Kindly help .
As there are data in which I need to put more than 4 for loops in which my future syncGroup results depends on results fetched from previous one .