• 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
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

finalize method

 
Ranch Hand
Posts: 97
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Enterprise bean class must not define finalize() method why???
 
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Soni,

EJB container is managing the lifecycle of an ejb i.e. container is responsible for creation and removal of EJBS. Almost all type of ejbs are pooled. Untill a system exception occurs or remove is called (in case of SFSB), container is keeping a designated set of beans in the pools, increasing during peak loads and decreasing them during off-peak loads

So It doesn't make a sense to have Finalize method in EJBs.

I hope this helps.

Raju
 
Ranch Hand
Posts: 125
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,

Yes, almost all types of beans are pooled(except SFSB). The finalize method is called when JVM decided this object need more and also purpose the finalize method is to realse the resources(non java resources, like connection to db, file etc).

We have alternative methods for realsing the resources in ejb framework. The finalize method is not guaranteed to execute. But in our EJB framework, for entitybean instance level resource realsing method is unsetEntityContext, it is guaranteed to executed by container when the instance removing from the pooled state, likewise for Stateless bean also ejbRemove methods.

I hope this also help your understanding.

Thanks & Regards
Kasimurugan R.
 
He's dead Jim. Grab his tricorder. I'll get his wallet and this tiny ad:
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic