Win a copy of Microservices Testing (Live Project) this week in the Spring forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • Ron McLeod
  • Jeanne Boyarsky
  • Paul Clapham
Sheriffs:
  • Liutauras Vilda
  • Henry Wong
  • Devaka Cooray
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Al Hobbs
  • Carey Brown
Bartenders:
  • Piet Souris
  • Mikalai Zaikin
  • Himai Minh

doubts on ejbpassivation and ejbactivation

 
Greenhorn
Posts: 19
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Greenhorn
Posts: 24
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Sheriff
Posts: 10445
227
IntelliJ IDE Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
reply
    Bookmark Topic Watch Topic
  • New Topic