Hi Mahindrakar,
Thank you for the response.
I have been reading
Mastering Enterprise JavaBeans by Ed Roman time and again to come up with a solution to the subject.
All my readings suggest that activation and passivation primarily takes care of managing the memory requirements.And this is what you have also mentioned.Definitely, releasing memory resources would give better performance.But we need to consider in the light of
how this is done and at
what expense.
Reading the following piece of information -
EJB Design Stategies-Partitioning Your Resources-Page 189 in Ed Roman's book makes me rethink on this issue.
Because acquiring and releasing resources may be costly operations, categorizing your resources as outlined is a vital step that you must take.Of course, the most stingy way to handle resources is to acquire them on a just-in-time basis and release then directly after use.For example, you could acquire a database connection only when you're about to use it and release it when you are done.Then there would be no resources to acquire/release during activation/passivation.In that case, you'd let the container pool your resources and thus manage the resources for you.The disadvantage to that is you need to code resource requests/releases over and over again in your bean code.
Clearly Ed Roman, wants to suggest an alternative for activation/passivation.
I normally use activation/passivation to store/retrieve objects in temporary storage and the DB apart from releasing Connection objects.
Keeping this in view, the following could be very costly operations
- Serialize the Object in the File and retrieve it for later use (IO operations may always be costly)
- Want to connect to the DB tier to store the objects, especially in Session Beans.In Entity Beans, ofcourse this is done automatically by calling ejbLoad()/ejbStore() atleast once.This involves dependency over the networks, which may always hamper performance
Also, calling these methods are at the discretion of the Container.If the Container calls it on a regular basis, I think it would be a performance hit.In that case, as Ed Roman suggests adding more code and taking care of activation/passivation on "need-based" basis may be a better option - Probably providing higher memory requirements and not depending on activation/passivation may give better performance!!
Please let me know your views on this.
Regards,
Sandeep
- Sun Certified Programmer for Java 2 Platform Scored 93 per cent
- Oracle JDeveloper Rel. 3.0 - Develop Database Applications with Java Scored 56 out of 59
- IBM Enterprise Connectivity with J2EE Scored 72 per cent
- Enterprise Development on the Oracle Internet Platform Scored 44 out of 56
[This message has been edited by Desai Sandeep (edited May 09, 2001).]