• Post Reply Bookmark Topic Watch Topic
  • New Topic

can i write finalize mthd in an EJB??  RSS feed

 
sarada chan
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
can v write main and finalize...if so will finalize gets executed??
 
Mark Spritzler
ranger
Sheriff
Posts: 17309
11
IntelliJ IDE Mac Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Well, I don't see a use case of when or why you would use it, and I wouldn't.

But, the definition of finalize for any class is always the same the way Java defines it. Whether a POJO or an EJB. When the object is garbage collected, then it runs, but only runs once, so if the object is resurrected somehow, the next time it is garbage collected, it will not run finalize again.

Mark
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!