Details
-
Type: Bug
-
Status: Closed
-
Priority: Major
-
Resolution: Won't Fix
-
Affects Version/s: None
-
Fix Version/s: None
-
Component/s: None
-
Labels:None
-
Number of attachments :
Description
Why is that implicit container hierachies must share the same lifecycle?
From DefaultPicoContainerLifecycleTestCase:
public void testComponentsAreStartedBreadthFirstAndStoppedDepthFirst()
{ MutablePicoContainer parent = new DefaultPicoContainer(); parent.registerComponentImplementation("recording", StringBuffer.class); parent.registerComponentImplementation(A.class); parent.registerComponentImplementation("child", DefaultPicoContainer.class); DefaultPicoContainer child = (DefaultPicoContainer) parent.getComponentInstance("child"); child.registerComponentImplementation(B.class); parent.registerComponentImplementation(C.class); parent.start(); parent.stop(); assertEquals("<A<C<BB>C>A>", parent.getComponentInstance("recording").toString()); }works, while:
public void testComponentsAreStartedBreadthFirstAndStoppedDepthFirst()
{ MutablePicoContainer parent = new DefaultPicoContainer(); parent.registerComponentImplementation("recording", StringBuffer.class); parent.registerComponentImplementation(A.class); parent.registerComponentImplementation("child", DefaultPicoContainer.class); DefaultPicoContainer child = (DefaultPicoContainer) parent.getComponentInstance("child"); child.registerComponentImplementation(B.class); parent.registerComponentImplementation(C.class); parent.start(); child.start(); child.stop(); parent.stop(); assertEquals("<A<C<BB>C>A>", parent.getComponentInstance("recording").toString()); }doesn't as the child tries to start the parent again?
As long as hierachies are build using child.setParent(parent) the lifecycle will work. I don't know what your intended use of implicit hierachies is as I'm not using them this way but thought I should mention it.
Activity
Aslak Hellesøy
made changes -
Field | Original Value | New Value |
---|---|---|
Assignee | Aslak Hellesoy [ rinkrank ] | |
Resolution | Won't Fix [ 2 ] | |
Status | Open [ 1 ] | Closed [ 6 ] |
This is a question, and as such belongs on the mailing list.