• Post Reply Bookmark Topic Watch Topic
  • New Topic

doubts on ejbpassivation and ejbactivation

 
Suresh Magi
Greenhorn
Posts: 19
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

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:
Cache Settings
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.

what is the reason for that??

Thanks,
Suresh B
 
Gabriel Vince
Greenhorn
Posts: 24
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

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.

g.
 
Jaikiran Pai
Sheriff
Posts: 10447
227
IntelliJ IDE Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
"Gabriel Gabriel"

Please click on the "My Private Messages" link on top of this page, for a message from JavaRanch.
 
Suresh Magi
Greenhorn
Posts: 19
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
then can anyone tell me how to mimic these concepts in real time through some sample client codes.

thanks,
Suresh
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!