[jboss-dev-forums] [Design the new POJO MicroContainer] - Re: Context installation causes StackOverflowError
jaikiran
do-not-reply at jboss.com
Sat Mar 21 11:45:15 EDT 2009
To show the state change, i changed the number of POJOs being installed to a small number (=3) and added some loggers in the POJOs:
SimplePOJO
public void start() throws Throwable
| {
| logger.info("Start of " + this);
| BeanMetaDataBuilder bmdb = BeanMetaDataBuilder.createBuilder("StringDummy" + this, String.class.getName());
|
| // Set access mode
| bmdb.setAccessMode(BeanAccessMode.ALL);
| logger.info(this + " is now going to install a String");
| this.kernel.getController().install(bmdb.getBeanMetaData(), new String("dummy"));
| logger.info(this + " successfully installed the String");
| }
|
|
OtherPOJO
| public void start() throws Throwable
| {
| logger.info("Start of " + this);
|
| BeanMetaDataBuilder bmdb = BeanMetaDataBuilder.createBuilder("OtherDummy" + this, String.class.getName());
|
| // Set access mode
| bmdb.setAccessMode(BeanAccessMode.ALL);
| logger.info(this + " is going to install a String");
| this.kernel.getController().install(bmdb.getBeanMetaData(), new String("otherdummy"));
| logger.info(this + " successfully installed the string");
| }
|
|
| And here's the output:
| Line 1 - [SimplePOJO] Start of SimplePOJO1
| Line 2 - [SimplePOJO] SimplePOJO1 is now going to install a String
| Line 3 - [SimplePOJO] Start of SimplePOJO2
| Line 4 - [SimplePOJO] SimplePOJO2 is now going to install a String
| Line 5 - [OtherPOJO] Start of OtherPOJO
| Line 6 - [OtherPOJO] OtherPOJO is going to install a String
| Line 7 - [OtherPOJO] OtherPOJO successfully installed the string
| Line 8 - [SimplePOJO] SimplePOJO2 successfully installed the String
| Line 9 - [SimplePOJO] SimplePOJO1 successfully installed the String
|
As can be seen, after Line 2 (the point where SimplePOJO1 tries to install a String), Line 3 shows that the start of (an unrelated context) SimplePOJO2 is invoked. The SimplePOJO2 will then try to install another string but that internally triggers a state change on (another unrelated context) OtherPOJO and so on...
On Line 3 i would have expected the output that you are seeing on Line 9. i.e. the install of the String happens and returns immidiately without any state changes to other (unrelated) contexts.
View the original post : http://www.jboss.org/index.html?module=bb&op=viewtopic&p=4220041#4220041
Reply to the post : http://www.jboss.org/index.html?module=bb&op=posting&mode=reply&p=4220041
More information about the jboss-dev-forums
mailing list