This week's book giveaway is in the Server-Side JavaScript and NodeJS forum.
We're giving away four copies of Node.js Design Patterns: Design and implement production-grade Node.js applications using proven patterns and techniques and have Mario Casciaro & Luciano Mammino on-line!
See this thread for details.
Win a copy of Node.js Design Patterns: Design and implement production-grade Node.js applications using proven patterns and techniques this week in the Server-Side JavaScript and NodeJS forum!
  • 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
  • Ron McLeod
  • Rob Spoor
  • Tim Cooke
  • Junilu Lacar
Sheriffs:
  • Henry Wong
  • Liutauras Vilda
  • Jeanne Boyarsky
Saloon Keepers:
  • Jesse Silverman
  • Tim Holloway
  • Stephan van Hulst
  • Tim Moores
  • Carey Brown
Bartenders:
  • Al Hobbs
  • Mikalai Zaikin
  • Piet Souris

Doubt in mock exam Qs from HFEJB

 
Ranch Hand
Posts: 31
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
 
Ranch Hand
Posts: 182
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
concurrent calls are not allowed.kindly mention the page number you are mentioning of spec.
 
Mini Sarin
Ranch Hand
Posts: 31
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 182
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 31
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 182
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

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
Posts: 31
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Yes you are right. Got it, thanks.
 
Can't .... do .... plaid .... So I did this tiny ad instead:
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
https://coderanch.com/wiki/718759/books/Building-World-Backyard-Paul-Wheaton
reply
    Bookmark Topic Watch Topic
  • New Topic