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.
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.
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