[jboss-user] [JBoss Microcontainer Development] New message: "Activating OnDemand beans from child controller"

Kabir Khan do-not-reply at jboss.com
Thu Jan 14 10:30:19 EST 2010


User development,

A new message was posted in the thread "Activating OnDemand beans from child controller":

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

Author  : Kabir Khan
Profile : http://community.jboss.org/people/kabir.khan@jboss.com

Message:
--------------------------------------------------------------
Fixing http://lists.jboss.org/pipermail/jboss-development/2010-January/015434.html I am adding a ScopedOnDemandDependencyTestCase (extends OnDemandDependencyTestCase similar to (Scoped)DuplicateAliasTestCase), but have found a deeper problem. If an OnDemand bean is installed in the main controller and is depended on by a bean in a child controller the OnDemand bean never gets activated and the child controller bean's dependency never resolved. 
I install Bean1 with OnDemand, goes to Describe state
I install scoped Bean2 with Automatic and a dependency on Bean1, goes to Instantiated state fine
 
When trying to move Bean2 to Configured state it does not resolve for the following reasons:
When enabling ondemand beans in AbstractDependencyItem.resolve(), it was looking at the wrong controller, I changed:
 
         if (unresolvedContext != null && ControllerMode.ON_DEMAND.equals(unresolvedContext.getMode()))
         {
            try
            {
               controller.enableOnDemand(unresolvedContext);

 
to
 
        if (unresolvedContext != null && ControllerMode.ON_DEMAND.equals(unresolvedContext.getMode()))
         {
            try
            {
               unresolvedContext.getController().enableOnDemand(unresolvedContext);

 
 
Now Bean1 correctly gets its requiredState set to INSTALLED. Unfortunately this is not enough.
 
In the normal/unscoped mode the mechanism is that AbstractDI.resolve() returns false, and we end up back in the resolveContexts() loop which finds Bean1 is not in its requiredState (INSTALLED).
 
In the scoped test, it does not get picked up since Bean2 was installed in the scoped controller whose resolveContexts() does not involve the main controller so Bean1 is never found.
 
I'll see if I can fix this
 

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

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




More information about the jboss-user mailing list