[jboss-user] [JBoss Microcontainer Development] New message: "Re: Profiling the dependency project"

Ales Justin do-not-reply at jboss.com
Tue Feb 9 10:17:22 EST 2010


User development,

A new message was posted in the thread "Profiling the dependency project":

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

Author  : Ales Justin
Profile : http://community.jboss.org/people/alesj

Message:
--------------------------------------------------------------
> is to further modify resolveContexts to not break out of the loop once it resolves some contexts for a state, e.g.
>  
>       *boolean* resolutions = *true*;
>       *while* (resolutions || onDemandEnabled)
>       {
>          *if* (onDemandEnabled)
>             wasOnDemandEnabled = *true*;
>  
>          onDemandEnabled = *false*;
>          resolutions = *false*;
>          *for* (ControllerState fromState : stateModel)
>          {
>             ControllerState toState = stateModel.getNextState(fromState);
>  
>             *if* (stateModel.isValidState(toState))
>             {
>                *if* (resolveContexts(fromState, toState, trace))
>                {
>                   resolutions = *true*;
> //                  break;  // Don't exit here
>                }
>             }
>          }
>       }
> 

Can you do a proof check (proof by-design) that this doesn't break the resolve logic.
At first sight it looks harmless, but we must make sure it's really OK.
e.g. 2nd resolve would resolve same contexts in both scenarios
 
>  
> All tests pass apart from the ones mentioned in http://community.jboss.org/message/524862#524862 which I know how to fix if Ales agrees: 
> > mailto:kabir.khan at jboss.com wrote:
> >  
> > I mean this:
> >  
> > *public* *void* testPlainLifecycleDependencyWrongOrder() *throws* Throwable
> >    {
> >       plainLifecycleDependencyWrongOrder();
> >  
> >       ControllerContext context2 = assertInstall(1, "Name2", ControllerState.+CONFIGURED+);
> >       ControllerContext context1 = assertInstall(0, "Name1");
> > +assertEquals+(ControllerState.+INSTALLED+, context2.getState());
> >  
> > SimpleBeanWithLifecycle bean1 = (SimpleBeanWithLifecycle) context1.getTarget();
> > +assertNotNull+(bean1);
> >  
> > SimpleBeanWithLifecycle bean2 = (SimpleBeanWithLifecycle) context2.getTarget();
> > +assertNotNull+(bean2);
> >  
> > +assertEquals+(1, bean1.createOrder);
> > +assertEquals+(2, bean2.createOrder);
> > +assertEquals+(3, bean1.startOrder);
> > +assertEquals+(4, bean2.startOrder);
> >    }
> >  
> > The new resolver works with
> > +assertEquals+(1, bean1.createOrder);
> > +assertEquals+(2, bean1.startOrder);
> > +assertEquals+(3, bean2.createOrder);
> > +assertEquals+(4, bean2.startOrder);
> >  
> > The actual hardcoded orders of beans 1 and 2 is an implemetation detail as I see it. The real check is making sure that the initial install of context 2 does not go beyond CONFIGURED and:
> > bean1.startOrder > bean1.createOrder
> > bean2.startOrder > bean2.createOrder
> > bean2.createOrder > bean1.createOrder
> > bean2.startOrder > bean1.startOrder
> >  
> >  
This does look like an impl detail, so you're fine to change it.

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

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




More information about the jboss-user mailing list