[jboss-user] [JBoss Microcontainer] New message: "Re: Undemanding Dependencies"

David Lloyd do-not-reply at jboss.com
Thu Jan 21 14:18:17 EST 2010


User development,

A new message was posted in the thread "Undemanding Dependencies":

http://community.jboss.org/message/521552#521552

Author  : David Lloyd
Profile : http://community.jboss.org/people/david.lloyd@jboss.com

Message:
--------------------------------------------------------------
> mailto:adrian at jboss.org wrote:
>  
> > mailto:david.lloyd at jboss.com wrote:
> >  
> > > mailto:adrian at jboss.org wrote:
> > >  
> > > Editor, ate my post again. ;-)
> > >  
> > > Following the last comment, I'm not sure you wouldn't want more fine grained control on
> > > which dependencies start your bean?
> > >  
> > > <bean name="A" mode="On Demand">
> > >    <property name="b"><inject bean="B" transitive-start="true"/></property>
> > > <bean>
> > >  
> > > <bean name="B" mode="On Demand"/>
> > Ah, that would be neat.  Let me see if I can wrap my brain around that...
> >  
> > So in this example, transitive-start would really mean that the targeted bean would control when this bean starts.  So the question is, if you had two such injected bean properties, when would A start?  When either injection is started, or only when both are?
> You could make a configuration option, e.g. something like
>  
> Require both dependencies to start:
>  
> <bean name="A" mode="On Demand">
>    <property name="b"><inject bean="B" transitive-start="required"/></property>
>    <property name="c"><inject bean="C" transitive-start="required"/></property>
> <bean>
>  
> Any one
>  
> <bean name="A" mode="On Demand">
>    <property name="b"><inject bean="B" transitive-start="optional"/></property>
>    <property name="c"><inject bean="C" transitive-start="optional"/></property>
> <bean>
>  
> 
> But unless starting A triggers some other knock-on effects, the second example is likely to stall with a missing dependency anyway. ;-)
> So I think you'd probably want all the dependencies marked transitive-start anyway?
 
The effect I'm envisioning for the latter case would run like this:
1. Something ("D") depending on C is started
2. This causes A to want to be demanded

3. A then demands that B start, since A has been demanded

4. A, B, and C are all started because D depended on C
 
Not sure if that really makes sense in terms of use case though.  Also (disclaimer!) I'm not sure that I'm using the term "demand" correctly in this context.

--------------------------------------------------------------

To reply to this message visit the message page: http://community.jboss.org/message/521552#521552




More information about the jboss-user mailing list