• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Doubt on Stateful session bean

 
Geetha Gubendran
Ranch Hand
Posts: 75
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi, I have a doubt with ejb 2.0 spec, it has been given in Pg. 76 and section 7.5.6 that "If a client-invoked business
method is in progress on an instance when another client-invoked call, from the same or different client,
arrives at the same instance of a stateful session bean class, the container may throw the
java.rmi.RemoteException to the second client[4], if the client is a remote client, or the
javax.ejb.EJBException, if the client is a local client
." I assume a conversational state can be maintained between a client and a single stateful session bean. If thats the case how cum another client invoked call come into play bfr even the first is still alive. Please clarify my doubt.

Thanks.

Regds,
Raj
 
Ramakrishnan Ponmudi
Ranch Hand
Posts: 72
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It is possible that another(second) client can able to call bean method by having it's remote object's stub.
 
Arun Natarajan
Ranch Hand
Posts: 30
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I don't have a complete answer. But part of it makes sense. Instead of a web application think of a java swing application as the client for the ejb. You could look up a stateful session bean reference and then have some multithreaded functionality where each thread invokes some method on the bean. This would mean concurrently calling two methods on the same bean instance and according to the spec will end up in an exception. However this only explains two calls coming from the same client. From your quote of the spec '..from the same or different client..', looks like it is implying that two different clients can invoke methods at the same time on the same bean instance. I do not think this is possible.
Ramakrishnan, could you claify how the second client would get access to the bean? Were you thinking of the first client passing it's reference to the second client? In that case, from the ejb's view wouldn't the two clients appear as just one client, since the second client would simply be using the first clients identify?
[ September 05, 2006: Message edited by: Arun Natrajan ]
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic