[jboss-dev-forums] [Design the new POJO MicroContainer] - Re: Scoped beans deployment

alesj do-not-reply at jboss.com
Wed Feb 14 08:15:18 EST 2007


"adrian at jboss.org" wrote : But isn't that something you already started to workaround with the
  | initial and describe visit?
  | 
  | i.e. The visitor is already in two stages.
  | 
  | It should simply be a case of making sure that the visited metadata uses
  | the correct controller.
  | 
  | In fact, the problem is where the visitee does
  | 
  |   |       KernelControllerContext controllerContext = visitor.getControllerContext();
  |   |       // Remember in local state
  |   |       controller = (KernelController) controllerContext.getController();
  |   | 
  | or similar.
  | 
  | Instead, it should just remember the ControllerContext and ask 
  | for the controller from the context when it needs it.
  | i.e. the second line should be done lazily
Ok, Controller should be set (lazily) in the 2nd (describe) phase - where possible (and I think it is possible in all cases).

But that is not the problem I have in mind.
e.g. When we add DependencyItem in DependsMetaData (or DependencyValueMetaData, ...), this context waits for this to be resolved till some other bean supplies this dependency - but it does this via AbstractController.resolveContexts which puts itself as a parameter to DependencyInfo.resolveDependencies. So we are 'asking' the 'describe state' Controller to resolve some bean that will actually be installed in child Controller.

  |    public boolean resolve(Controller controller)
  |    {
  |       boolean previous = resolved;
  |       ControllerContext context;
  | 
  |       if (dependentState == null)
  |          context = controller.getInstalledContext(iDependOn);
  |       else
  |       {
  |          context = controller.getContext(iDependOn, dependentState);
  |          if (context == null)
  |          {
  |             if (ControllerState.INSTALLED.equals(dependentState))
  |                context = controller.getInstalledContext(iDependOn);
  |          }
  |       }
  | 

View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4016357#4016357

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4016357



More information about the jboss-dev-forums mailing list