• 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

stateful session bean does not allow loopback(re-entry)

 
Bartender
Posts: 2119
13
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
On Frits's notes p.17-18, stateful bean will trhwo an illegalLoopbackException (blocking reentry). Why it is designed in this way?
 
Creator of Enthuware JWS+ V6
Posts: 3395
312
Android Eclipse IDE Chrome
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
This is what the specs say:

The container must ensure that only one thread can be executing a stateless or stateful session bean instance at any time. Therefore, stateful and stateless session beans do not have to be coded as reentrant. One implication of this rule is that an application cannot make loopback calls to a stateless or stateful session bean instance.

 
Himai Minh
Bartender
Posts: 2119
13
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks for Frit's reply.

From the diagram on Frit's noted on p.18, loopback is just method 1on a bean calls method 2 on another bean, and method 2 calls method 3 on the first bean. Or method 1 calls method 3.
I don't see loop back is related to multiple threading.
 
Frits Walraven
Creator of Enthuware JWS+ V6
Posts: 3395
312
Android Eclipse IDE Chrome
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Yeah, I had the same doubts. The only logical explanation to this is that the container cannot always distinguish the thread related to the first method call (coming from the client) from the thread related to the second method call (coming from bean B). The good thing for us (developers) is that we don't have take the re-entrance into account.
 
Himai Minh
Bartender
Posts: 2119
13
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Frits. Thanks for your reply.
I guess the container needs two threads to do the loopback call. One thread is to handle the first method call (coming from a client) and another thread is to handle the second loopback method call (coming from bean B).
But with stateful and stateless bean, only one thread is allowed to execute on this bean. That may be why loopback call is not supported in stateful or stateless bean.
 
reply
    Bookmark Topic Watch Topic
  • New Topic