[jboss-user] [Microcontainer] - Installing a context leads to resolve of other unrelated con

jaikiran do-not-reply at jboss.com
Wed Jul 15 10:08:11 EDT 2009


I was looking at the deployment framework/MC kernel flow and noticed this code in the AbstractController:

  | public void install(ControllerContext context) throws Throwable
  |    {
  |     // removed irrelevant code from forum post
  | ... 
  |       install(context, trace);
  |    }
  | 


  | protected void install(ControllerContext context, boolean trace) throws Throwable
  |    {
  |       
  |          // set the required state
  |          ControllerMode mode = context.getMode();
  |          context.setRequiredState(mode.getRequiredState());
  | 
  |          if (trace)
  |             log.trace("Installing " + context.toShortString());
  | 
  |          context.setController(this);
  |          DependencyInfo dependencies = context.getDependencyInfo();
  |          if (trace)
  |          {
  |             String dependsOn = "[]";
  |             if (dependencies != null)
  |             {
  |                try
  |                {
  |                   Set<DependencyItem> set = dependencies.getIDependOn(null);
  |                   if (set != null)
  |                      dependsOn = set.toString();
  |                }
  |                catch (Throwable t)
  |                {
  |                   log.warn("Exception getting dependencies: " + t);
  |                   dependsOn = null;
  |                }
  |             }
  |             if (dependsOn != null)
  |                log.trace("Dependencies for " + name + ": " + dependsOn);
  |          }
  | 
  |          boolean ok = incrementState(context, trace);
  |          if (ok)
  |          {
  |             try
  |             {
  |                registerControllerContext(context);
  |             }
  |             catch (Throwable t)
  |             {
  |                // This is probably unreachable? But let's be paranoid
  |                ok = false;
  |                throw t;
  |             }
  |          }
  |          if (ok)
  |          {
  | 		// Jaikiran: Why do we do this?
  |             resolveContexts(trace);
  |          }
  | ...

1) We start with install a specific context
2) Increment the state of that specific context
3) Register the controller context for that specific context
4) Resolve "other" (unrelated) contexts. Why do we do this? As an example, when a specific context = A is being installed why do we start resolving (which internally involves incrementing/moving the context to different state) contexts B, C etc... which are not related to A? Or am i wrong in understanding this piece of code?


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

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



More information about the jboss-user mailing list