I have an (beginning/intermediate?) question about cfc's and persistence in the application scope.

I understand that cfc instances cannot be replicated in a cluster to allow for session failover.

I am trying to set an instance of a cfc to the application scope in a clustered environment. In this cfc I have set some global settings like dsn and have some global functions for login and stuff like that. I know this is probably not the best place for login functions but the application is small and I'm just trying to get more practice with cfcs.

Here is the code I use from Application.cfm. (Thanks to R Camden for revealing how the cool kids do instantiation.)

<!---if the FlcTechCert cfc is not instantiated then do it--->
<cfif NOT IsDefined("application.FlcTechCert")>
  <cflock scope="application" timeout="10" type="exclusive">
    <cfif NOT IsDefined("application.FlcTechCert")>
<cfinvoke component="FlcTechCert" method="init" returnvariable="application.FlcTechCert">
     </cfif>
  </cflock>
</cfif>

So far so good.

On to the error...

I have never seen this personally but some people are getting this error.

Element FLCTECHCERT.DSN is undefined in APPLICATION.

Is it possible that the Identifier FlcTechCert is visible in the application scope of the server in the cluster on which the cfc has not been already instantiated?

In other words, could the identifier for the cfc instance gets replicated but none of the content?

My thinking of how the above code should work is that if the client hits the other server in the cluster, application.FlcTechCert won't yet exist and that server should create its own instance. Which would be fine for what I'm doing.


Thank You,
Jeff Borisch


You are subscribed to cfcdev. To unsubscribe, please follow the instructions at 
http://www.cfczone.org/listserv.cfm

CFCDev is supported by:
Katapult Media, Inc.
We are cool code geeks looking for fun projects to rock!
www.katapultmedia.com

An archive of the CFCDev list is available at 
www.mail-archive.com/[email protected]

Reply via email to