11.1. Synchronization and <cflock>
Synchronization is Java's way of keeping shared objects from getting corrupted when competing operations are being performed on them. This should be a familiar concept from ColdFusion and from database design.
In ColdFusion you store, for example, variables in the Session scope. Any time you read or write data from the Session, Application, or Server scopes in ColdFusion you must lock those variables. That's because data stored in these scopes is memory resident. While that makes them very fast to access, it also makes them vulnerable to data corruption if two competing operations were to access the same data at the same time and perform some conflicting operation.
In order to prevent this kind of corruption, ...
Get Java™ for ColdFusion® Developers now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.