Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

how is cflock and cffinally guaranteed?

Explorer ,
Mar 31, 2011 Mar 31, 2011

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>

Or will this do what I want, regardless of whatever and where the exception is thrown?

<cftry>

   <cflock ...>

      ...

   </cflock>

<cfcatch>

   <cfexit method="exittemplate">

</cfcatch>

</cftry>


Anyone to make this more clear to me?
Thank you
Martin

TOPICS
Advanced techniques
539
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Apr 02, 2011 Apr 02, 2011
LATEST

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

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Resources