<?xml version="1.0" encoding="utf-8"?>
<rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:dc = "http://purl.org/dc/elements/1.1/" xmlns="http://purl.org/rss/1.0/">
	<channel rdf:about="http://livedocs.adobe.com/">
	<title>LiveDocs Comments - coldfusion - 6 - Developing_ColdFusion_MX_Applications_with_CFML - sharedVars8.htm</title>	
		<link>http://livedocs.adobe.com/</link>
		<description>Macromedia LiveDocs - online documentation with user feedback.</description>
		<copyright>Copyright 2009, Macromedia, Inc.</copyright>
		<dc:date>2009-11-25T17:08:30</dc:date>
		<dc:language>en-us</dc:language>
		<items>
			<rdf:Seq>
				<rdf:li rdf:resource="http://livedocs.adobe.com/coldfusion/6/Developing_ColdFusion_MX_Applications_with_CFML/sharedVars8.htm#52871" />
				<rdf:li rdf:resource="http://livedocs.adobe.com/coldfusion/6/Developing_ColdFusion_MX_Applications_with_CFML/sharedVars8.htm#21454" />
				<rdf:li rdf:resource="http://livedocs.adobe.com/coldfusion/6/Developing_ColdFusion_MX_Applications_with_CFML/sharedVars8.htm#21426" />
				<rdf:li rdf:resource="http://livedocs.adobe.com/coldfusion/6/Developing_ColdFusion_MX_Applications_with_CFML/sharedVars8.htm#20225" />
				<rdf:li rdf:resource="http://livedocs.adobe.com/coldfusion/6/Developing_ColdFusion_MX_Applications_with_CFML/sharedVars8.htm#20223" />
			</rdf:Seq>
		</items>
	</channel>
	
	<item rdf:about="http://livedocs.adobe.com/coldfusion/6/Developing_ColdFusion_MX_Applications_with_CFML/sharedVars8.htm#52871">
		<title>coldfusion/6/Developing_ColdFusion_MX_Applications_with_CFML/sharedVars8.htm</title>
		<link>http://livedocs.adobe.com/coldfusion/6/Developing_ColdFusion_MX_Applications_with_CFML/sharedVars8.htm#52871</link>
		<description>halL makes perfect sence.  No screen name's example uses an exclusive application-scope lock inside a read-only application-scope lock, which can create a dead-lock (quote: 'You can also cause deadlocks if you nest locks of different types. An example of this is nesting an exclusive lock inside a read-only lock of the same scope or same name.')&lt;br /&gt;To be safe rather than sorry use the example in the main doc.</description>
		<dc:creator>Sabaidee</dc:creator>
		<dc:type>0 0</dc:type>
		<dc:date>2006-09-10T23:07:43</dc:date>
	</item>
	<item rdf:about="http://livedocs.adobe.com/coldfusion/6/Developing_ColdFusion_MX_Applications_with_CFML/sharedVars8.htm#21454">
		<title>coldfusion/6/Developing_ColdFusion_MX_Applications_with_CFML/sharedVars8.htm</title>
		<link>http://livedocs.adobe.com/coldfusion/6/Developing_ColdFusion_MX_Applications_with_CFML/sharedVars8.htm#21454</link>
		<description>Please note: I've marked this as a Macromedia comment, but I'm a technical writer, not a lock expert, so this might not be the final word.&lt;br&gt;&lt;br&gt;First, timeouts are required, as indicated in the comments. We will fix this error in the documentation for the next release.&lt;br&gt;&lt;br&gt;Second, no screen name corrected the initial extremely long timeouts down to 30 seconds in a second posting. That might still be higher than necessary, but it isn't totally unreasonable.&lt;br&gt;&lt;br&gt;Third, I believe that the reasoning behind the suggested technique is that this code maximizes efficiency, as follows. &lt;br&gt;&lt;br&gt;First, note that there are no nested locks. You cannot nest a lock of one type inside a lock of the same type: the scope is already locked, so the inner lock would just time out. &lt;br&gt;&lt;br&gt;The read-only lock contains code that every page in the application must execute. It can be entered simultaneously by multiple pages and has only one line inside it. However, if the application scope variables are not set yet, the read-only lock must be released before the exclusive lock can be taken and the variables can be set. &lt;br&gt;&lt;br&gt;Because multiple pages might be in the read-only lock at one time, there is a possibility that multiple pages could end up with a false local app_is_initialized variable following the read-only lock code. All these pages would end up going through the exclusive lock code (unless they timed out). The re-check of the local variable tests whether one of those other pages has beaten the current page to setting the variables, and avoids the cost of multiple sets at the expense of one read. &lt;br&gt;&lt;br&gt;Does this make sense?</description>
		<dc:creator>halL</dc:creator>
		<dc:type>1 1</dc:type>
		<dc:date>2004-09-17T10:50:54</dc:date>
	</item>
	<item rdf:about="http://livedocs.adobe.com/coldfusion/6/Developing_ColdFusion_MX_Applications_with_CFML/sharedVars8.htm#21426">
		<title>coldfusion/6/Developing_ColdFusion_MX_Applications_with_CFML/sharedVars8.htm</title>
		<link>http://livedocs.adobe.com/coldfusion/6/Developing_ColdFusion_MX_Applications_with_CFML/sharedVars8.htm#21426</link>
		<description>WHOAH.  I am *really* not understanding the point of those lengthy timeouts in No screen name's example!  I have a suspicion that noname is confusing the timeout of the lock with the timeout of application variables themselves.&lt;br /&gt;&lt;br /&gt;Anyone from Macromedia care to comment?&lt;br /&gt;&lt;br /&gt;Also, the second check for IsDefined(&quot;Application.initialized&quot;) seemed redundant to me too.  Again, anyone from Macromedia care to explain why we need that second one?</description>
		<dc:creator>parrot person</dc:creator>
		<dc:type>0 0</dc:type>
		<dc:date>2004-09-16T15:47:18</dc:date>
	</item>
	<item rdf:about="http://livedocs.adobe.com/coldfusion/6/Developing_ColdFusion_MX_Applications_with_CFML/sharedVars8.htm#20225">
		<title>coldfusion/6/Developing_ColdFusion_MX_Applications_with_CFML/sharedVars8.htm</title>
		<link>http://livedocs.adobe.com/coldfusion/6/Developing_ColdFusion_MX_Applications_with_CFML/sharedVars8.htm#20225</link>
		<description>My bad on posting above (got side track):&lt;br /&gt;Timeout should be like 30 for both cflocks, because it is how long will it wait before responding to timeOutThrown if specified in lock...</description>
		<dc:creator></dc:creator>
		<dc:type>0 0</dc:type>
		<dc:date>2004-08-17T15:05:11</dc:date>
	</item>
	<item rdf:about="http://livedocs.adobe.com/coldfusion/6/Developing_ColdFusion_MX_Applications_with_CFML/sharedVars8.htm#20223">
		<title>coldfusion/6/Developing_ColdFusion_MX_Applications_with_CFML/sharedVars8.htm</title>
		<link>http://livedocs.adobe.com/coldfusion/6/Developing_ColdFusion_MX_Applications_with_CFML/sharedVars8.htm#20223</link>
		<description>Example above not complete and can be more efficient.  First, it does not include cflock timeouts.  I found the inside (2nd) cfif initialized creates inconsistancies in session variables (also duplicate of previous cfif for how got in).  I saw no reason for the 2nd setting of app_is_initialized inside the inner cflock, for it was set to that anyways to pass cfif to get in.  NOTE: My example is based on 2 days for times.  Reasoning is I do not change application variables regularily (centeralization of common variables, and not trackers for in most cases there are more efficient ways).  Given that customize them to your uses...&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;!---Initilialize local flag to false, then cflock tries to read it if not too busy every 44 hours leaving 4 hours to set---&gt;&lt;br /&gt;  &lt;cfset app_is_initialized=False&gt;&lt;br /&gt;  &lt;cflock scope=&quot;application&quot; type=&quot;readonly&quot; timeout=&quot;158400&quot;&gt;&lt;cfset app_is_initialized=IsDefined(&quot;APPLICATION.initialized&quot;)&gt;&lt;/cflock&gt;&lt;br /&gt;&lt;!---Check the local flag. If application was verified (less than 2 days and not too busy to read)---&gt;&lt;br /&gt;  &lt;cfif not app_is_initialized&gt;&lt;br /&gt;  	&lt;cflock scope=&quot;application&quot; type=&quot;exclusive&quot; timeout=&quot;172800&quot;&gt;&lt;br /&gt;        &lt;!---Set application variables---&gt;&lt;br /&gt;        &lt;cfset APPLICATION.varible1 = someValue &gt;&lt;br /&gt;       	... &lt;br /&gt;    &lt;/cflock&gt;&lt;br /&gt;  &lt;/cfif&gt;</description>
		<dc:creator></dc:creator>
		<dc:type>0 0</dc:type>
		<dc:date>2004-08-17T14:54:55</dc:date>
	</item>
	</rdf:RDF>

