• 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 in EJB

 
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,
Can anyone plz tell me why we can't define finalize() method in EJB & we have to define a public constructor in case of MDB.

Thanks in advance.

Aparna.
 
Ranch Hand
Posts: 8945
Firefox Browser Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by AparnaYadav Yadav:
Hi,
Can anyone plz tell me why we can't define finalize() method in EJB & we have to define a public constructor in case of MDB.

Thanks in advance.

Aparna.



Finalize method is discouraged because it may be never be called.

In MDB, it is container which handles the life cycle of MDB and it is also responsible for pooling the instances. Public no-arg constructor is required so that the container create instances and pool them.
 
AparnaYadav Yadav
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello Pradip,
I am reffering to EJB spec. for MDB there is a explicit line specifying not to override finalize() method for MDB. but this is not mentioned for any other type of EJB.

Thanks,
Aparna
 
Pradeep bhatt
Ranch Hand
Posts: 8945
Firefox Browser Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by AparnaYadav Yadav:
Hello Pradip,
I am reffering to EJB spec. for MDB there is a explicit line specifying not to override finalize() method for MDB. but this is not mentioned for any other type of EJB.

Thanks,
Aparna



I Checked the spec again, the finalize should not be overriden for any EJB bean classes. Search for "finalize" in the pdf document.
 
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi All,

According to Spec one should not override finalize method in any type of bean. It is the responsibility of Container to take care of GC. And moreover, EJBClient dealing with Stub of the Bean.

[ October 21, 2005: Message edited by: Sai Krishna Chitta ]
[ October 21, 2005: Message edited by: Sai Krishna Chitta ]
 
Oh sure, it's a tiny ad, but under the right circumstances, it gets bigger.
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic