File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

calling remove a staless bean

 
jeff mutonho
Ranch Hand
Posts: 271
  • 0
  • Mark post as helpful
  • send pies
  • 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?
 
Peer Reynders
Bartender
Posts: 2933
5
  • 0
  • Mark post as helpful
  • send pies
  • 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
  • 0
  • Mark post as helpful
  • send pies
  • 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
 
Frank Ertl
Ranch Hand
Posts: 59
  • 0
  • Mark post as helpful
  • send pies
  • 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
  • 0
  • Mark post as helpful
  • send pies
  • 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?
 
B.Sathish
Ranch Hand
Posts: 372
  • 0
  • Mark post as helpful
  • send pies
  • 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
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
well said
Thanx

 
Don't get me started about those stupid light bulbs.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic