This week's book giveaway is in the Jobs Discussion forum.
We're giving away four copies of Soft Skills and have John Sonmez on-line!
See this thread for details.
The moose likes EJB Certification (SCBCD/OCPJBCD) and the fly likes Release resource in @remove method Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Soft Skills this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Certification » EJB Certification (SCBCD/OCPJBCD)
Bookmark "Release resource in @remove method" Watch "Release resource in @remove method" New topic

Release resource in @remove method

Fei Wong

Joined: Jun 15, 2009
Posts: 11
Hi, I have study the EJB book saying that it should release resource in @predestroy method.
But I have a question that can the resource release in @remove method?
Romeo Son
Ranch Hand

Joined: Mar 12, 2007
Posts: 92

The @remove annotation is used only on Stateful session beans methods. After the method annotated with @remove returns, the instance is destroyed by the container. This is because with Stateful session beans every client gets its own instance and this way the performance is greatly improved. (Think in this scenario if every instance would need to wait a timeout to be destroyed)

I agree. Here's the link:
subject: Release resource in @remove method