This content has been marked as final.
Show 2 replies
-
1. Re: Duplicate DeploymentContext registration
alesj Feb 11, 2009 2:37 PM (in response to alesj)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. -
2. Re: Duplicate DeploymentContext registration
adrian.brock Feb 13, 2009 9:02 AM (in response to alesj)"alesj" wrote:
This eliminates the duplicates:
I found it very difficult to understand what the problem was from the forum threads
other than it produced a spurious warning, but I used your deployment structure to create a test that reproduced it and fixed the problem.
https://jira.jboss.org/jira/browse/JBDEPLOY-158
The issue was that both registerMBeans() from the top level deployment
and registerMBeans() from the subdeployment were trying to install the
sub-subdeployment mbean.
I've fixed it such that each mbean only recurses to one-level which is I think
what your fix was trying to do, but it wasn't very clean.
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.
The idea is that the mbean is deployed as early as possible so you can analyse it
using JMX.
If you add/remove components or subdeployments later there are hooks to (un)register the mbeans.
I also started some much need missing tests to make sure this doesn't regress.