• 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 all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Paul Clapham
  • Ron McLeod
  • Jeanne Boyarsky
  • Tim Cooke
Sheriffs:
  • Bear Bibeault
  • Henry Wong
  • Devaka Cooray
Saloon Keepers:
  • salvin francis
  • Tim Moores
  • Tim Holloway
  • Stephan van Hulst
  • Frits Walraven
Bartenders:
  • Jj Roberts
  • Carey Brown
  • Scott Selikoff

Can a stateless session bean be removed by client?

 
Ranch Hand
Posts: 126
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
EJB Core Contracts and Requirements, Page 42:

A client may remove a stateful session bean by invoking a method of its business interface designated as a Remove method.

The lifecycle of a stateless session bean does not require that it be removed by the client. Removal of a stateless session bean instance is performed by the container, transparently to the client.

"The lifecycle of a stateless session bean does not require that it be removed by the client." I cannot understand this sentence, I suppose it want to tell stateless session bean can or cannot be removed by the client. However, it looks like the most important word "can" or "cannot" is lost.
 
Ranch Hand
Posts: 68
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
What would be the purpose of removing stateless session bean by client?
These beans aren't connected to clients between method calls. They are... well stateless.
Immediately after being used by client SLSB is returned to pool of SLSB's and the rest is up to container.
 
Ranch Hand
Posts: 142
Netbeans IDE Java Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
In one word , NO
Stateless sessions beans are sent back to the bean pool between method calls as they are not tied to any pone client every time a client calls a method on a SLSB the container randomly selects one from the bean pool and associates it with a client passing its reference to the client .
Hence as SLSB are are only removed from the pool when the server/container sees it fit to do so , which is when its low on resources or depending on the timeout setting of the server specific xml discriptor file (basically it is server specific) , and never by the client on calling remove or any other method . It may also be removed if during a method call an exception occours from which the bean is not able to recover.
 
Greenhorn
Posts: 16
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Client cannot remove Stateless Session Bean.

Only the Container can remove the Stateless Session Bean.

The following are the cases where the Stateless Session Bean will be destroyed.

1. If the Container finds that thee are already more beans in the pool, then there is possibility that few beans will be removed.
If there is any @PreDestroy method, it will be called first and then destroyed

2. If Container crashes, then beans will be removed without calling @PreDestroy method
[ December 12, 2008: Message edited by: LakshmiNarayana Kodali ]
 
reply
    Bookmark Topic Watch Topic
  • New Topic