On Monday, November 5, 2012 6:43:12 AM UTC-8, teamteama wrote:
>
> Hey Brian,
>
> I wonder if you ever came to any conclusion with this. We have had the 
> same problem with re-initing our MG apps under 3.2.
>
>
>
Not yet, but Marc Esher (of MxUnit) and I have been trading some emails.  I 
think there are some options and I'm working on some ideas.

What I have gone to since my last post is I'm using the 
application[modelglue_app_key].reset() approach to rehashing the MG apps.  
I still don't have a good approach yet for changing the beanfactory as it 
screws up in-progress requests (think, a controller gets an object from the 
beanfactory, the beanfactory is changed mid-request, now that object is not 
linked to the beanfactory any longer so the rest of the controller code 
blows up).

I believe what we need to do is move the beanfactory and MG app(s) to the 
side and let them finish any running requests and then spool up a new 
beanfactory and MG app(s) as if it were the first hit of an application 
(which for me, inits OK).  I'm doing something like this in onRequestStart 
when my reload key is found:

<!--- while onApplicationStart() is running, errors can be thrown so move 
the beanfactory over during shutdown --->
<cfset application.tempbf = application.cs />

<cfset onApplicationStart() />

Then in onRequestEnd:

<cfif structKeyExists(application, "tempbf") AND 
isObject(application.tempbf)>
    <cfset application.tempbf.getBean('ormService').shutdown() /><!--- this 
is transfer-specific to shut down the cache, ignore it --->
    <cfset structDelete(application, "tempbf") />
</cfif>    

This probably wouldn't hold up under load so my next step is to give it a 
timestamp of when it was "set aside" and delete it say 5 minutes later to 
allow any long running requests to finish.  I think the rest of a solution 
is to do the same with application[modelglue_app_key].

The alternative is to look at how MG's setBeanFactory() works and introduce 
some kind of application locking that would prohibit MG requests from 
executing while the beanfactory is updated.  Not sure if that would work or 
if it would fail due to contention issues. 


Brian

-- 
Model-Glue Sites:
Home Page: http://www.model-glue.com
Documentation: http://docs.model-glue.com
Bug Tracker: http://bugs.model-glue.com
Blog: http://www.model-glue.com/blog

You received this message because you are subscribed to the Google
Groups "model-glue" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/model-glue?hl=en

Reply via email to