[long read] Info/help needed on extending EJB3 container
sintel Feb 15, 2007 9:37 AMHi,
I'm a thesis student and have been given the assignment over the past few months to extend or write a J2EE container to support real time adaptation (changing an implementation of a bean with another one without the clients knowing) on the basis of context information. Before this assignment I had good experience with regular Java but none with J2EE.
After reading up on context management and all kinds of runtime adaptation, I ended up choosing JBoss to do this 'little' college work since it looked to be better documented than glassfish, and because real world developers prefer it.
I've been looking at source code for over a month and trying to write some as well. I first started with the regular EJB container and then switched over to the EJB3 one to try and keep things simple. But frankly, I'm not feeling like I'm making any progress, the amount of code I wrote at the moment is laughable. The thing is that I'm being drowned in all the code and it's very hard to make out what is for what, how it gets used etc. The documentations provided on the site are all very basic and do not tell anything on how the containers are layered, how an invocation travels through the code for every kind of bean (where does it start at the server side, what invocation object, interceptors, the pools, all those context classes, to the beaninstance?) or something like that. Starting a container from scratch to plug into Jboss doesn't seem like a viable idea either.
My work plan would read something like this: At this point I would just like to extend the existing EJB3 container so that it supports multiple bean implementations, but only with the same configuration (so nothing else changes..), and have the possibility to add/remove implementations at run time... Does this sound at all doable in a relatively short time without breaking any interoperability? To do this I thought about putting a class between ejbcontainer and sessioncontainer with necessary overrides and extra methods for the extra functionality to achieve this, but am kinda in the dark on what this exactly entails (what do i need multiple instances of and can I change them safely..).
The next step would then be to route the invocations through a dispatcher which I control from my own developped classes. The dispatchers get held in the extended container and if i ask one to change implementation, it asks a specific implementation to the container and uses that one for every invocation.
To achieve this step I think I need to change the proxies that are sent to the client to contain a reference to the dispatcher instead of whatever it refers to now (seems different for stateful/stateless/...). From what I understood up till now, I will need to have different dispatchers and adapt all the different end-containers for each kind of bean (or just the end containerinterceptor?).
Any thoughts on all this and some light or links on how invocations progress through the app server are greatly appreciated.
As this is work for a thesis, I do not know if any of this is appreciated, since it doesn't involve fixing bugs, completing code, making jboss better for the 'general public'. Any code I write is of course strictly meant for research.
Sorry if this wasn't all that coherent. Hope this is posted in the right subforum.