I have an mbean declared as the following in my jboss-service.xml:
<mbean code="com.mbean.MyBootstrap" name="service.server.monitor:service=MyBootstrap"> <depends>service.server.monitor:service=OPTIONALMBean</depends> </mbean>
but I want that OPTIONALMBean be optional
this means that: if OPTIONALMBean is not on the another SAR that I've placed it in, I want that MyBootstrap works normally
how can I achieve this?
thanks in advance
This looks like you don't need that depends at all then. :-)
You just need to make sure MyBootstrap has proper logic.
As this one is hard to impl; e.g. what if OPTBean is actually present, but just happens to be deployed after MyB.
Is this still OK? Or how can I tell OPTBean is actually gonna be deployed? etc ...
you're right ales
actually, I need that if
MyBootstrapis present, it runs first than
I have the following scenarios:
MyBootstrapcan be present WITHOUT OPTIONALMBean
OPTIONALMBean can be present WITHOUT
OPTIONALMBean can be present WITH MyBootstrap, BUT, in this case, OPTIONALMBean NEEDs to run first
You could probably add custom Deployers / DUPs,
which would register all beans in 1st phase -- collect the names,
where it would then add proper deps in 2nd phase, only if the deployment fits your scenario.
If the mbeans come from 2 diff deployments (sars), then this gets even harder, if not impossible.
I didn't got it 100% but i understand a little
i'm using the <depends> just to be sure that OPTIONALMBean runs first when it is on the class path
i dont know implementation details of how jboss do this mbean dependency management.. but, looking to the big picture, it looks possible
changing the question so
how can I set the order of the mbeans? just the order : OPTIONALMBean and MyBootstrap afterwards?
"The value of the module-order could be implicit or strict
The strict value indicates that the deployments of the modules will
be done in the order that would be specified in the application.xml
and jboss-app.xml file .
The implicit value indicates the deployment would follow the order
which would be specified in the DeploymentSorter.
The default order will be implicit to support backward compatibility"
so, a jboss-app with:
guarantees the deploy order of my sars
but this is not happening.. sometimes MyBootstrap is still deployed first than OPTIONALMBean