Copy link to clipboard
Copied
Consider this
<cflock ...>
<cftry>
...
<cfcatch>
<cfexit method="exittemplate">
</cfcatch>
</cftry>
</cflock>
Will the </cflock>-related code execute despite the <cfexit> or maybe even <cfabort>?
Unfortunately, one cannot write
<cftry>
<cflock ...>
...
<cfcatch>
<cfexit method="exittemplate">
</cfcatch>
<cffinally>
</cflock>
</cffinally>
</cftry>
<cftry>
<cflock ...>
...
</cflock>
<cfcatch>
<cfexit method="exittemplate">
</cfcatch>
</cftry>
Copy link to clipboard
Copied
My instinct is that the first approach will work fine: CF needs to be clever enough to clear locks even when the closing CFLOCK tag is never encountered. This would be pretty easy for you to test, really.
Either the first or third approach will work: if all that's happening in the CFCATCH is the CFEXIT call, then you don't need to have that in the lock anyhow: there's nothing that needs locking.
If there was code in the CFCATCH that needed to be within the same lock as the rest of the code, then the first approach would be necessary.
--
Adam