[jboss-dev-forums] [Design the new POJO MicroContainer] - Re: Duplicate DeploymentContext registration
alesj
do-not-reply at jboss.com
Wed Feb 11 14:37:44 EST 2009
This eliminates the duplicates:
| Index: deployers-structure-spi/src/main/java/org/jboss/deployers/structure/spi/helpers/AbstractDeploymentContext.java
| ===================================================================
| --- deployers-structure-spi/src/main/java/org/jboss/deployers/structure/spi/helpers/AbstractDeploymentContext.java (revision 83617)
| +++ deployers-structure-spi/src/main/java/org/jboss/deployers/structure/spi/helpers/AbstractDeploymentContext.java (working copy)
| @@ -993,12 +993,15 @@
| log.warn("Unable to register deployment mbean " + context.getName(), e);
| }
| }
| - List<DeploymentContext> children = context.getChildren();
| - for (DeploymentContext child : children)
| - registerMBeans(child, true);
| - List<DeploymentContext> components = context.getComponents();
| - for (DeploymentContext component : components)
| - registerMBeans(component, false);
| + if (this == context || registerContext == false)
| + {
| + List<DeploymentContext> children = context.getChildren();
| + for (DeploymentContext child : children)
| + registerMBeans(child, true);
| + List<DeploymentContext> components = context.getComponents();
| + for (DeploymentContext component : components)
| + registerMBeans(component, false);
| + }
| }
|
| /**
| @@ -1021,12 +1024,15 @@
| log.trace("Unable to unregister deployment mbean " + context.getName(), e);
| }
| }
| - List<DeploymentContext> children = context.getChildren();
| - for (DeploymentContext child : children)
| - unregisterMBeans(child, true);
| - List<DeploymentContext> components = context.getComponents();
| - for (DeploymentContext component : components)
| - unregisterMBeans(component, false);
| + if (this == context || unregisterContext == false)
| + {
| + List<DeploymentContext> children = context.getChildren();
| + for (DeploymentContext child : children)
| + unregisterMBeans(child, true);
| + List<DeploymentContext> components = context.getComponents();
| + for (DeploymentContext component : components)
| + unregisterMBeans(component, false);
| + }
| }
|
And another issue.
Isn't DeployersImpl::registerMBean called too early?
As at that point we don't have any components yet,
since the deployment hasn't gone yet through deployment stages.
It's just installed + manual mode --> Not_Installed state.
View the original post : http://www.jboss.org/index.html?module=bb&op=viewtopic&p=4209212#4209212
Reply to the post : http://www.jboss.org/index.html?module=bb&op=posting&mode=reply&p=4209212
More information about the jboss-dev-forums
mailing list