• 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

Stateless bean removal

 
Ranch Hand
Posts: 98
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi all,
if client call remove() in home interface, will container call ejbRemove() in session bean? From HF EJB, ebjRemove should be called by container.
Please advise.. thanks.
 
Ranch Hand
Posts: 146
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
in session bean it depends on if it is stateful or stateless.
1. stateful... it will call the remove
2. stateless... it will not call. The container is responsible for creation and removal.

if u look at the state diagram for the beans you will know if it is the result of the clients action or the container does it.
 
George Fung
Ranch Hand
Posts: 98
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
If client call "remove()" in stateless bean, will ejbremoved() be called?
 
George Fung
Ranch Hand
Posts: 98
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Let me rephrase the question.
If client call "remove()" in home interface, what will happen?
 
Ranch Hand
Posts: 135
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
George,
you will get RemoveException if you call remove() method forcefully. if your client is remote, then Container converts that RemoveException to RemoteException and throws it to the client.

Thanks,
Ugender
 
Balaji Anand
Ranch Hand
Posts: 146
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
i am not sure if i will get an exception for calling a remove on a stateless session bean. all i could say is... i have called it in my session beans trial.. nothing will happen. the container will not actually bother abt the call it will neither give any exception nor call ejbRemove(). i dont have the HFEJB with me now but it is mentioned in that book in the session beans chapter.
can someone clarify about the exception... anyways how do i force a remove() call to a session bean in the first place?
 
Ranch Hand
Posts: 36
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You will not get an exception for calling remove() on the EJBObject of a stateless bean. (spec p88) You are telling the container you are done with it but it is up to the container when it wants to destroy the bean (ejbRemove()). Instead, calling remove() will destroy the reference to the component interface. Any client that tries to use that same reference will get a NoSuchObject(Local)Exception.
 
Ranch Hand
Posts: 71
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
calling ejbRemove() behaviour doesnot change whether it is stateless or statefull Session Bean.
 
George Fung
Ranch Hand
Posts: 98
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
From HFEJB p 550. It states "Stateless session bean clients will NEVER get a RemoveException.

So,whats' result when client call .remove() in stateless bean? it seems a tough question
 
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,
If you want to call remove method in the Home interface, it should have arguement. It is missing in your question.

The home interface(ie EJBHOME) has to method
1. remove(handle h)
2. remove(object o)

If you call the second one, you will get exception because its only for the entity bean.

For stateless session been, nothing will happen. The container only remove the beans to conserve the resources.
 
Greenhorn
Posts: 14
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I think when remove is called on a stateless session bean, the bean goes back to the pool created by the container. Now its upto the container to decide. if the container thinks that it is running low on resources, it might decide to reduce the pool size by removing the beans from the pool during which it will call ejbRemove() method for the corresponding bean instance.
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic