• 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

why is @Remove not working

 
Ranch Hand
Posts: 2234
Eclipse IDE Firefox Browser Redhat
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi ,

Hi ,

I have coded a ejb3 stateless session bean as shown



Please tell me why CallBackMethod() is not getting called called . Do you need to do any configurations ??

Thank you .


 
Ranch Hand
Posts: 650
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
@Remove only makes sense for statefull session beans, not stateless. In the case of a stateless session bean, as soon as the call is finished, the bean is placed back in the pool (or destroyed).

However, for a statefull session bean, the bean maintains its conversational state until it times out. The @Remove annotation is how you (the bean designer) can tell the container that the session is over and the bean can be recycled.

I hope this helps,
 
Mark E Hansen
Ranch Hand
Posts: 650
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I've had another read of your original question and I think I see there was some confusion.

The @Remove annotation does not indicate that a method is a call-back. It simply says that the statefull session bean should be recycled after this method call finished.

For example, assume you have a statefull session bean with 4 methods: doStep1(), doStep2(), doStep3() and doStep4(). The bean should retain conversational state throughout all the steps. However, after the application calls doStep4(), it is finished with this bean. Using the @Remove annotation, you tell the container to recycle the bean after this method call is finished.

Without the @Remove annotation on that method, the bean would persist (and take up valuable resources) until it times out.

I think what you're looking for, however, is the @PreDestroy annotation. This can be used on any bean (stateless/statefull session and MDB) and annotates a method (public, private, etc.) as a callback for the lifecycle event.

Sorry I went off-track with my first response - my brain was stuck on the @Remove annotation rather than what you were actually asking
 
Ravi Kiran Va
Ranch Hand
Posts: 2234
Eclipse IDE Firefox Browser Redhat
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thank you for the answer and for the KT with @Remove annotation .
 
Mark E Hansen
Ranch Hand
Posts: 650
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Ravi Kiran V wrote:Thank you for the answer and for the KT with @Remove annotation .

KT?
 
Ravi Kiran Va
Ranch Hand
Posts: 2234
Eclipse IDE Firefox Browser Redhat
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Knowledge Transfer
 
reply
    Bookmark Topic Watch Topic
  • New Topic