Well, let's think about this.Set Parent, expects a fully hydrated bean factory to be in place and get handed to MG. Which makes sense, because ParentBeanFactories may/usually service more than one MG application instance. So MG couldn't reload the bean factory on it's own, without screwing over other (potential) MG instances.
So, I'd say it is thread safe as long as your reload functionality for the parent bean factory is thread safe.
Would it be possible to do something like this?
if( reloadBeanFactory){
--Lock--
var newBeanFactory = createNewParentBeanFactory;
application.parent_bean_factory_for_model_glue = newBeanFactory;
--Unlock
}
That would minimize the time the parent bean factory is stale. When you
have it fully hydrated, then replace the application instance with the
newly instantiated one.
Thoughts? DW
Brian G <mailto:[email protected]> Thursday, November 08, 2012 2:23 PMOn Thursday, November 8, 2012 9:19:56 AM UTC-8, Dan Wilson - [email protected] wrote:I don't disagree per se, but since this is the general design paradigm of a parent bean factory and continuous deployment and/or code pushes without interrupting users is a significantly valuable goal, I think we should look at it.I think the problem is that MG's setParent() for the parent_bean_factory is not thread-safe.I'm trying alternative approaches today using onApplicationStop() but that results in even more weirdness. Request scope variables set in a controller don't exist when I get to a view template... I'm going to try to start at the beginning, load testing each step, and see where I can get to. Also might see if I can setup a basic MG app and demonstrate it there too.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 Dan Wilson <mailto:[email protected]> Thursday, November 08, 2012 12:19 PMOne way to look at this is the parent bean factory is not controlled by ModelGlue. It's expected this will be instantiated and passed to Model Glue. (Look in ModelGlue.cfm)Reloading the Parent Bean Factory is the responsibility of the parent bean factory control mechanism. So, if you need to restrict access to this, you need to do it in the location where you reload your parent bean factory. You may consider creating your new beanfactory in a separate application variable, then switch it over when it is instantiated. But as it stands, I don't see how MG can get involved with this process, because the parent bean factory lives inside a different context.DW Brian G wrote: Brian G <mailto:[email protected]> Thursday, November 08, 2012 9:57 AMOn Wednesday, November 7, 2012 5:48:24 PM UTC-8, Dan Wilson - [email protected] wrote:Correct - the exclusive named lock only prevents duplicate initializations; it doesn't do anything related to non-reinit MG requests from accessing values/objects that are changing during the initialization like the parent bean factory.We need a method of telling MG to lock/unlock access to the parent bean factory while we reinit it. An exclusive lock on the app scope might do it? I don't know if that would be hard to obtain in practice in production or if it would just cause a lot of timeouts?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 Dan Wilson <mailto:[email protected]> Wednesday, November 07, 2012 8:48 PM I believe that takes place in ModelGlue.cfm The lock is exclusive and is double checked as is best practice.However, I don't believe your parent bean factory is under that same lock. So when you remove that bean factory, it's out of the protected zone, thus problems arise, no?Dw Brian G <mailto:[email protected]> Wednesday, November 07, 2012 8:31 PM Let's say you have application.cs which is your PARENT_BEAN_FACTORY.You have 10 other users hitting the site, they are in the middle of a request to index.cfm which is using an already-initialized Model-Glue and they are happily processing requests.Now, I start the process of ?reinit=true which in my OnRequestStart, first calls onApplicationStart() (or just recreates application.cs) and then subsequently re-initializes Model Glue.But, the nanosecond application.cs is reassigned, the other 10 users with in-progress requests piped through Model-Glue to the service layer begin acting crazy because, as you correctly point out, the beanfactory to which MG has a reference no longer exists.We need some way of locking model-glue from performing a request while we recreate the bean factory and assign it.BrianOn Monday, November 5, 2012 4:45:46 PM UTC-8, Dan Wilson - [email protected] wrote: --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
-- 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
<<inline: compose-unknown-contact.jpg>>
<<inline: postbox-contact.jpg>>
