• 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

calling remove a staless bean

 
Ranch Hand
Posts: 271
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Page 88 of the spec says

Clients use the create and remove methods on the home interface of a stateless session bean in the
same way as on a stateful session bean. To the client, it appears as if the client controls the life cycle of
the session object. However, the container handles the create and remove calls without necessarily
creating and removing an EJB instance.



When does a stateless session bean client ever use "remove" on the home interface(of the stateless session bean)?What the point of doing that when control of creating and removing a stateless session bean is in the hand of the container?
 
Bartender
Posts: 2968
6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
When the client uses a no-argument create() method it could be dealing a stateless or stateful session bean - it has no way to tell.
 
jeff mutonho
Ranch Hand
Posts: 271
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks Peer.I understand the create() stuff.I think you misunderstood my question.
I basically wanted to know ,when a client would ever call remove on a stateless session bean (seeing that that's what the spec says in that quote)

jee mutonho
 
Ranch Hand
Posts: 59
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I think what Peer wanted to say is the following: The client often does not know by calling the no-args-create() which kind of bean he uses: stateless or stateful. So a client should always call remove when he's done to tell the container: "Hey, I'm finished with that bean, you can nuke it!"
Of course: When you code EJB and client you know what kind of SessionBean you're using. But more often this is not the case, especially in bigger projects with strictly divided roles.
 
jeff mutonho
Ranch Hand
Posts: 271
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Ok , here's what the spec says

Clients use the create and remove methods on the home interface of a stateless session bean in the

My question is how does one call the remove method on a stateless session bean's home interface?
 
Ranch Hand
Posts: 372
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
The client can always call remove on the home interface remove(Handle h), by passing the Handle to the component interface (EJBObject). This is the same as calling remove() on the component interface (on the EJBObject). Both these calls would destroy the client's dedicated EJBObject, be it a stateless or stateful bean.If it is a stateful bean, the bean also gets removed. If it is statless, all beans are in the pool and bean removal is not tied to client remove call. But the remove call for a stateless session bean would still destroy the EJBObject and any method calls after remove would result in an exception as the stub's EJBObject is no more
 
jeff mutonho
Ranch Hand
Posts: 271
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
well said
Thanx

 
reply
    Bookmark Topic Watch Topic
  • New Topic