I known that stateful ejb bean will passivate when the idle time of
this bean exceed the Cache Idle Timeout time.
I deployed a stateful bean on glassfish,
and made following setting EJB Container setting:
Removal Timeout: 5400 Seconds
Cache Idle Timeout: 10 Seconds.
I used client to access above stateful bean, the client invoked
bussiness method , then sleep 20 Seconds(exceed 10s) and then calls another business method
I expected the method marked '@PrePassivate' would be invoked.
But the passivate method did not be invoked.
well.. I would not rely on the timeouts.. an application server may passivate and activate EJBs as needed..
you should use the methods only for cleaning before passivation and recovering after activation. But if the app server does not see a reason for it (enough memory for caching, anything, ..) it may decide to keep the EJB. These timeouts I would take as hints, not rules Or am I wrong? please confirm somebody.