[jboss-user] [JBoss Microcontainer] - controller.uninstall() fails when overriding the KernelControllerContext name

Emanuel Muckenhuber do-not-reply at jboss.com
Fri Apr 23 10:51:23 EDT 2010


Emanuel Muckenhuber [http://community.jboss.org/people/emuckenhuber] created the discussion

"controller.uninstall() fails when overriding the KernelControllerContext name"

To view the discussion, visit: http://community.jboss.org/message/539255#539255

--------------------------------------------------------------
When i manully set a name for a KernelControllerContext the uninstallation of contexts does not work properly.

BeanMetaDataBuilder builder = BeanMetaDataBuilder.createBuilder("test", Object.class.getName());
      
ObjectName name = new ObjectName("org.jboss:service=test");
      
KernelControllerContext ctx = new AbstractKernelControllerContext(null, builder.getBeanMetaData(), new Object());
ctx.setName(name);
 
getController().install(ctx);
getController().uninstall(name);
      
assertNull(getController().getContext(name, null));


In this case the context does not get properly uninstalled and ends up in the ERROR state (without any error message - which IMHO is also a bit weird). The name change happens in the "InstallAction" which uses the original name of the BeanMetaData to register the context in the KernelRegistry:

BeanMetaData metaData = context.getBeanMetaData();
Object name = metaData.getName();
registry.registerEntry(name, context);


Which then changes the controllerContexts back to the name which was defined in the BeanMetaData. Basically you can lookup the correct context, however the context cannot be remove from allContexts in the controller - since the name it got registers now is different from the context name:

controller.uninstall(objectName)
...
ControllerContext context = getRegisteredContextAndInterruptAsynchronousInstall(objectName);
....
unregisterControllerContext(context);
....
Object beanMetaDataName = context.getName();
allContext.remove(beanMetaDataName);


Obviously when i set the original context name before uninstalling this works fine.

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

Reply to this message by going to Community
[http://community.jboss.org/message/539255#539255]

Start a new discussion in JBoss Microcontainer at Community
[http://community.jboss.org/choose-container!input.jspa?contentType=1&containerType=14&container=2114]

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/jboss-user/attachments/20100423/1dd16b39/attachment.html 


More information about the jboss-user mailing list