-
1. Re: Cyclic dependencies
alesj Aug 20, 2010 8:46 AM (in response to alesj)>From what I've read, MC can do cyclic injections, but can't do cyclic dependencies (<depends>) , true?
Injection is also just a dependency.
We can do whatever you can do programatically.
It's the different states that make this happen.e.g. if A depends on B and B depends on A, both at ctor, then of course it's impossible to solve this
class A {
A(B b) {}
}class B {
B(A a) {}
}but if you set the A into B via setter (which gets populated at different state), then it would work.
class B {
B() {}void setA(A a) {}
}The same goes for <demand> which can take the state at which you depend on target,
while you can also declare target's state.<depends> is slightly different, as it has this states already "hardcoded" -- same functionality as you're used from old JMX kernel.
I just started with MC so I am not yet too aware of what terms like Installed mean from the MC POV.
MC state machine works on top of linear states:
public AbstractController() { addState(ControllerState.NOT_INSTALLED, null); addState(ControllerState.PRE_INSTALL, null); addState(ControllerState.DESCRIBED, null); addState(ControllerState.INSTANTIATED, null); addState(ControllerState.CONFIGURED, null); addState(ControllerState.CREATE, null); addState(ControllerState.START, null); addState(ControllerState.INSTALLED, null);
While you can dynamically add new states -- see DeployersImpl.
Could you pls point me to some good material explaining this issue, and perhaps the types of relations in MC?
* http://anonsvn.jboss.org/repos/jbossas/projects/presentations/trunk/microcontainer/
* http://java.dzone.com/articles/a-look-inside-jboss-microconta-0
-
2. Re: Cyclic dependencies
alesj Aug 20, 2010 8:48 AM (in response to alesj)Could you pls point me to some good material explaining this issue, and perhaps the types of relations in MC?
* http://anonsvn.jboss.org/repos/jbossas/projects/presentations/trunk/microcontainer/
* http://java.dzone.com/articles/a-look-inside-jboss-microconta-0
Also quite useful is the MC sandbox / playground demos that I have:
* http://anonsvn.jboss.org/repos/jbossas/projects/demos/microcontainer/trunk/