Consider this case:
1) You have a MC bean (named Bean1).
2) Bean1 during its START phase (through the start() operation) wants to
"install" another MC bean lets say Bean2 (which is of a completely different
"type"). So Bean1 has this piece of code in its start
public void start()
{
// install Bean2
getKernel().getController().install(bean2.getBeanMetadata(),bean2Instance);
}
3) Now the important part - let's consider that the KernelController for this Kernel
already has a bunch of contexts which are ready to go to START phase. So let's
consider the controller has this bunch of contexts ready to got to START state - {Bean3,
Bean4, Bean5}
From what i see, when Bean1 installs Bean2 through the controller, the
controller passes this context *and also the other contexts* through the various states.
So during this single install operation on Bean2, the controller actually even starts
incrementing the state of other contexts. So Bean3 is now moved to START state (and its
start() operation is invoked).
Questions:
1) Is this API that is being used in the Bean1.start() the correct way to install a bean?
I guess yes, because i could not find any other API which does a similar thing :)
2) What is the best way to install a bean without affecting the state of other *unrelated
beans*. In this example, Bean2 and Bean3 are unrelated, still installing Bean2 is causing
a state change in Bean3. How do i avoid this?
View the original post :
http://www.jboss.org/index.html?module=bb&op=viewtopic&p=4219822#...
Reply to the post :
http://www.jboss.org/index.html?module=bb&op=posting&mode=reply&a...