aspose file tools*
The moose likes EJB Certification (SCBCD/OCPJBCD) and the fly likes Doubt in mock exam Qs from HFEJB Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Certification » EJB Certification (SCBCD/OCPJBCD)
Bookmark "Doubt in mock exam Qs from HFEJB" Watch "Doubt in mock exam Qs from HFEJB" New topic
Author

Doubt in mock exam Qs from HFEJB

Mini Sarin
Ranch Hand

Joined: Apr 07, 2006
Posts: 31
Q-9 in HFEJB final mock exam:

Which statements concerning stateless session beans are true?
Option c) A single instance can support concurrent calls.

is not marked correct, although the spec says that a single stateless bean instance can handle concurrent calls. Is it not supposed to be this way?

Please clarify.

Thanks
Mini
Rajan Murugan
Ranch Hand

Joined: Jun 24, 2006
Posts: 182
concurrent calls are not allowed.kindly mention the page number you are mentioning of spec.


With Regards,<br /> Rajan<br />"Java Rocks"
Mini Sarin
Ranch Hand

Joined: Apr 07, 2006
Posts: 31
Section 7.5.8 on Page 83 of the spec :-

Clients are not allowed to make concurrent calls to a stateful session object. 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[7] if the client is a remote client, or the javax.ejb.EJBException if the client is a local client.
This restriction does not apply to a stateless session bean because the container routes each request to a different instance of the session bean
class.

What does the last line mean? Is concurrent access allowed or not?

Thanks
Mini
Rajan Murugan
Ranch Hand

Joined: Jun 24, 2006
Posts: 182
Hi Mini,
you seem to be using the ejb 2.1 spec.In case you are preparing for SCBCD 1.3 then the spec is ejb 2.0.

Any stateless bean serves only one client at a time.
Refer to 103 of hfejb in case you have a copy.

" a single bean can handle multiple clients,as long as only one client at a time is in the middle of a business method invocation."
Mini Sarin
Ranch Hand

Joined: Apr 07, 2006
Posts: 31
Hey Rajan,

Thanks for correcting. Yes I was using spec2.1

Now I am referring to the correct spec but I can see the same stmt there on Page 76 sec 7.5.6.

" a single bean can handle multiple clients,as long as only one client at a time is in the middle of a business method invocation."


What HFEJB mentions is correct, but this is what the conatiner takes care of, giving each request to a new instance. But does that mean if client tries to make concurrent calls on the stateless bean, it will get exception as it does in the case of a stateful session bean.
Rajan Murugan
Ranch Hand

Joined: Jun 24, 2006
Posts: 182
Originally posted by Mini Sarin:
Hey Rajan,

Thanks for correcting. Yes I was using spec2.1

Now I am referring to the correct spec but I can see the same stmt there on Page 76 sec 7.5.6.



What HFEJB mentions is correct, but this is what the conatiner takes care of, giving each request to a new instance. But does that mean if client tries to make concurrent calls on the stateless bean, it will get exception as it does in the case of a stateful session bean.



How can a client call on a particular bean? When each bean is same and do not have unique identity as in stateful.Everytime you make a call a freely available bean will be picked up,if not available one is created.
Mini Sarin
Ranch Hand

Joined: Apr 07, 2006
Posts: 31
Yes you are right. Got it, thanks.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Doubt in mock exam Qs from HFEJB