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

finalize()

 
Ranch Hand
Posts: 71
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I know a Message-Driven bean cannot have a finalize() method, but is this true of Session and Entity beans?
 
Ranch Hand
Posts: 85
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
According to the spec Page 95,199 and 324 None of the bean types must define the finalize() method in their bean class.

Cheers
 
Ranch Hand
Posts: 82
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Specs says finalize() is not allowed in any bean class.

Can some one please explain why is finalize() NOT allowed in any of Bean?
 
Nileesha Bojjawar
Ranch Hand
Posts: 85
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
IMO,
finalize() method is used to do things you want to do just before the object is destroyed or garbage collected and for entity beans the container manages the lifecycle of the bean to the most extent and hencewe get all the security, transaciton managements etc and hence may be it must not be implemented by the bean provider for the container to have control of the resources. Also the way the container manages beans and pools is implementation specific. The jvm calls the finalize method on a object when it figures out that there are no more references to the object and in a remote scenario it cannot be figured out, and because EJBs are meant to be remote components you can never gaurantee that the objects reside in the same JVM and is totally based on the container implementation.

I might be totally worng in my thinking!!!
 
These are not the droids you are looking for. Perhaps I can interest you in a tiny ad?
Free, earth friendly heat - from the CodeRanch trailboss
https://www.kickstarter.com/projects/paulwheaton/free-heat
reply
    Bookmark Topic Watch Topic
  • New Topic