This week's book giveaway is in the Mac OS forum.
We're giving away four copies of a choice of "Take Control of Upgrading to Yosemite" or "Take Control of Automating Your Mac" and have Joe Kissell on-line!
See this thread for details.
The moose likes EJB Certification (SCBCD/OCPJBCD) and the fly likes ejbRemove( ) Pls Help Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


JavaRanch » Java Forums » Certification » EJB Certification (SCBCD/OCPJBCD)
Bookmark "ejbRemove( ) Pls Help" Watch "ejbRemove( ) Pls Help" New topic
Author

ejbRemove( ) Pls Help

Jaime Yong
Greenhorn

Joined: Oct 05, 2005
Posts: 20
When client call remove() on a passivated stateful session bean, will container call ejbRemove() before killing the bean. Can someone help me as this is not in the HFEJB ?
B.Sathish
Ranch Hand

Joined: Aug 18, 2005
Posts: 372
yes, This was clarified by Kathy Sierra in this forum some 3 years back. The gist of it is : If a client calls remove on a passivated stateful session bean, the call will be treated just like a business method call. This is because a client calling remove() means the association between the client and the bean is not yet over. ie the bean might still do some things for the client. Hence the container activates the bean, then calls ejbActivate() and then calls ejbRemove() and then removes the bean. But if the bean times out while passivated, the relationship between the bean and the client is considered to be over and the bean will be removed without getting activated hence will miss an ejbRemove() call.
Rizwan Mohammad
Ranch Hand

Joined: Sep 02, 2005
Posts: 445
Sathish,
What does this mean " But if the bean times out while passivated,..." Is passivated bean can timed out? how can we set this time??


Rizwan
SCJA, SCJP, SCWCD, SCBCD, SCDJWS.
B.Sathish
Ranch Hand

Joined: Aug 18, 2005
Posts: 372
hey Rizwan,
Looks like you have not come to the 4th chapter in HFEJB yet. This will be clear after you read that, where you will come across the stateful bean lifecycle. A stateful bean can timeout when in the passivated state and go to the "does not exist" state. The server has to do this for scalability. It can't keep the bean around for ever waiting for the client to come back.If there is no activity for quite some time, the server would normally passivate the bean first. If there is still further inactivity for some more time, the bean would be destroyed permanently with no hope of recovery. This is what we call "time out while passivated" . This of course does not mean that every bean has to be passivated first before timing out. The logistics is upto the container and it may timeout the bean when it is in the "method-ready" state also and send it to "does not exist" state .(Refer Stateful session bean lifecycle in 4th chapter)

Regarding setting the time-out values, the specification does not talk about setting time-out or any other passivation parameters such as memory, no of max beans etc, but most vendors will give you a way to manipulate these. When I was reading, I too thought there will be a way to set the time-out in the DD like HttpSession , but that's not the case. Chapter 4 talks about all this very clearly.
Rizwan Mohammad
Ranch Hand

Joined: Sep 02, 2005
Posts: 445
Thanks a lot for your detail explanation Satheesh. Yeah I havent yet come to 4th Chapter. It is going really slow to me these days.. I need to pick up fast.
B.Sathish
Ranch Hand

Joined: Aug 18, 2005
Posts: 372
It takes some time to come out of the "JSP/Servlet" mindset . I think the first 2 chapters are the toughest to get through in HFEJB, if you are somewhat new to EJB's. After that you'll have a cruise. By the end of chapter 10, you'll have an overwhelming feeling, but at that time, you have come too far to give up

Good Luck
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: ejbRemove( ) Pls Help