Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Stateful session beans

 
Gurumurthy Ramamurthy
Ranch Hand
Posts: 273
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

Stateful session beans can't be reentrant, is it? Why?
 
Gustavo Dutra
Greenhorn
Posts: 22
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

only Entity Beans can be reentrant.

It is in the specification, session and MDB cannot be reentrant.
 
Vaithiya Sundaram
Ranch Hand
Posts: 98
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Session Beans(both stateful and stateless) can not be reentrant because
a session bean can serve only one client at a time.
 
David Follow
Ranch Hand
Posts: 223
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
All,

what exactly is meant by " reentrant"?

D.
 
Bhanu
Ranch Hand
Posts: 48
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Exactly..my doubt is also the same. I do remember about reentrent code/programs in Operating Systems literature. I really don't know(understand) what does that mean.
I would appreciate if any one enlighten us on this.
 
Keerthi P
Ranch Hand
Posts: 203
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
This property specifies whether an entity bean instance should allow loop-back call sequences, which are call sequences where one of the bean's methods calls another bean's method which in turn calls a method in the calling bean instance.

Here is an example:

EntityA:

methodA() {
entityB.methodB((EntityA)ctx.getEJBObject());
}

EntityB:

methodB(EntityA entityA) {
entityA.someMethod();
}
 
David Follow
Ranch Hand
Posts: 223
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi all,

I understand, but what are the exact implications of it?
Why does the spec. explicitly forbid it?

D.
 
ravi janap
Ranch Hand
Posts: 389
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi

It is relevant in case of entity beans with container-managed relationships with each other. The "reentrant" property lets a calling bean to in turn allow loopback call on its methods by the called bean.

Thanks

-- Ravi
 
ravi janap
Ranch Hand
Posts: 389
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Why is it not allowed in Session Bean is explained by Specs:

The container must ensure that only one thread can be executing an instance at any time. Note that a session object is intended to support only a single client. Therefore, it would be an application error if two clients attempted to invoke the same session object. One implication of this rule is that an application cannot make loopback calls to a session bean instance..............
 
Ajith Kallambella
Sheriff
Posts: 5782
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Another good topic for EJB/J2EE forum. Moving this thread there...
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic