Today, I realized that "type" in cflock is very important and essential for shared data manipulation. In Adobe Coldfusion documentation, which said "type" is optional in cflock but when we need to process shared data, it's not optional. IT'S VERY IMPORTANT. Why I know like that is because of I'm currently preventing about concurrency issues for my project. In these coding, we already used cftransaction as putting the whole queries and processes within cftransaction but cannot prevent at all. After that, I've put cflock again outside of cftransaction like that.
2 <cftransaction action="BEGIN">
3 <cftry>
4 ....
5 ....
6 ....
7 <cftransaction action="COMMIT" />
8 <cfcatch type="Any">
9 ERROR...!!!
10 <cftransaction action="ROLLBACK" />
11 </cfcatch>
12 </cftry>
13 </cftransaction>
14</cflock>
Once I've changed my coding and let users know that we've successfully prevent it and told them to test it again. Unfortunately, it cannot prevent concurrency issue again means like we failed again. That's why I've read through documentation and added type = "exclusive" in cflock and told them to test it again.
2 <cftransaction action="BEGIN">
3 <cftry>
4 ....
5 ....
6 ....
7 <cftransaction action="COMMIT" />
8 <cfcatch type="Any">
9 ERROR...!!!
10 <cftransaction action="ROLLBACK" />
11 </cfcatch>
12 </cftry>
13 </cftransaction>
14</cflock>
Finally, the outcome is they don't face concurrency issue anymore and seems it's fine. As my experience, I wanna keep in mind that "type" in cflock are not optional.

Android
Top of Page
#1 by Steve on 7/4/11 - 11:35 PM
#2 by ppshein on 7/5/11 - 12:14 AM
Thanks for your information.
#3 by spills on 7/5/11 - 9:25 AM
#4 by ppshein on 7/5/11 - 9:48 AM
I've already tried isolation=serializable in cftransaction. Unfortunately, encounter error like "transaction can't
be serialized" once two users run this coding at the same time. That's why I've used as my example.
#5 by spills on 7/5/11 - 10:55 AM
#6 by ppshein on 7/5/11 - 8:12 PM