Application and Session Scope on Shared Servers

I saw this discussion on cfaussie about how you can access variables between applications on a shared cf server and kind of overlooked it. I though it was going to be more banter about how if you give two applications the same name on a shared server you could run into conflicts.

However, Scott Barnes from mossyblog has posted more about it here:

http://www.mossyblog.com/archives/437.cfm

here's the code in question

<cffunction name="markApplicationsForRefresh" returntype="void">

<cfargument name="bRefreshSessions" type="boolean" default="false">



<cfset var appTracker = createObject("java",

"coldfusion.runtime.ApplicationScopeTracker")>


<cfset var appNames = appTracker.getApplicationKeys()>



<cfset var sessTracker = createObject("java",

"coldfusion.runtime.SessionTracker")>




<cfset var appName = "">

<cfset var app = "">

<cfset var sessions = "">

<cfset var sessName = "">



<cfloop condition="#appNames.hasMoreElements()#">



<cfset appName = appNames.nextElement()>

<cfset app = appTracker.getApplicationScope(appName)>

<div><strong>#appName#</strong> <cfif bRefreshSessions> and its

sessions</cfif> marked for rebuild next request</div>

<cfif structKeyExists(app, "EnvironmentManager")>

<cfset app.bRefresh = true>

</cfif>



<cfif bRefreshSessions>

<cfset sessions = sessTracker.getSessionCollection(appName)>

<cfloop item="sessName" collection="#sessions#">

<cfset sessions[sessName].bRefresh = true>

</cfloop>

</cfif>



</cfloop>



</cffunction>

News Feed

Recent comments

love it, tag/watch, [url="http://mediastop.info/...
rdnheczuftqsjoh, Compare chart electronic...
We're pretty much trying things to see what works...
Still going. I try to keep it agile, but I wouldn...
Yes, the mythical PO, what process are you using...