First question, is ModelGlue reloading on every request? Because if so, the remoteProxyBeanFactory would be getting recreated for every request, and will keep forgetting about the remoteProxy it creates.

Second, and this is odd. ColdSpring is not really creating an instance off your remote service, it's just generating the file for you (well, actually it does make an instance, but as far as a remote client is concerned, it isn't). When you request that service through remoting, or soap, or wsdl, a new instance of your remote service is created for that connection. So there's always a kind of disconnect between the instance of the service as far as the remote client is concerned and the service that MG knows about. It's a brain teaser, sorry, and I'm explaining badly because I'm tired!

-Chris


On Mar 15, 2006, at 3:42 PM, Ken Dunnington wrote:

I have another question about Flash Remoting support. :) It's not a
big deal, since Flash doesn't actually use the framework, and my
proxies were created with no problems, but where exactly does the
remote proxy "live"? Maybe I'm not understanding the
create/destroyRemoteProxy() methods, but I thought createRemoteProxy()
would have CS manage the singleton, meaning that once called,
isConstructed() would return true (unless CS was reloaded.) However,
after I create it, the isConstructed() method only returns true for
the life of the request, afterwards it returns false. I tried looking
through the code but couldn't figure it out.

I have a method in my controllers called ToggleRemoteService() that
looks like this:

<cffunction name="ToggleRemoteService" access="public"
returnType="void" output="false" hint="I start or stop the Remote
Service">
<cfargument name="event" type="ModelGlue.Core.Event" required="true" />
        <cfset var remoteServiceFactory =
getModelGlue().getConfigBean("&remoteAssetService") />
        <cfset var message = "Remote Asset Service " />
        <cfif arguments.event.argumentExists("restart")>
                <cfif arguments.event.getArgument("restart") is true>
                        <cfif remoteServiceFactory.isConstructed()>
                                <cfset remoteServiceFactory.destroyRemoteProxy() 
/>
                        </cfif>
                        <cfset remoteServiceFactory.createRemoteProxy() />
                        <cfset message = message & "restarted." />
                </cfif>
        <cfelse>
                <cfif remoteServiceFactory.isConstructed()>
                        <cfset remoteServiceFactory.destroyRemoteProxy() />
                        <cfset message = message & "destroyed." />
                <cfelse>
                        <cfset remoteServiceFactory.createRemoteProxy() />
                        <cfset message = message & "created." />
                </cfif>
        </cfif>
        <cfset arguments.event.setValue("message",message) />
</cffunction>

And a status method:
<cffunction name="GetRemoteServiceStatus" access="public"
returnType="void" output="false" hint="I return the status of the
remote service">
<cfargument name="event" type="ModelGlue.Core.Event" required="true" />
        <cfset var remoteServiceFactory =
getModelGlue().getConfigBean("&remoteAssetService") />
<cfset arguments.event.setValue ("assetServiceStatus",remoteServiceFactory.isConstructed())
/>
</cffunction>

This is called manually (for testing and for a status page, so you can
"restart" it for whatever reason) and, like I said, everything seems
to be working but I was just wondering about why isConstructed() would
return false once createRemoteProxy() was called? Am I just completely
missing something obvious here? :)



Reply via email to