About Question enthuware.oce-ejbd.v6.2.389 :

Moderator: admin

Post Reply
ramy6_1
Posts: 124
Joined: Wed Feb 12, 2014 2:44 am
Contact:

About Question enthuware.oce-ejbd.v6.2.389 :

Post by ramy6_1 »

Hello ,

In case this question about statless session bean instead of stateful , I think the correct answer will be (1 or 2)

Correct ?

admin
Site Admin
Posts: 10036
Joined: Fri Sep 10, 2010 9:26 pm
Contact:

Re: About Question enthuware.oce-ejbd.v6.2.389 :

Post by admin »

Yes, it could be 1 or 2. Because a container is free to create multiple instances of a stateless session bean to service multiple request or it could use just one instance as well.
If you like our products and services, please help us by posting your review here.

himaiMinh
Posts: 358
Joined: Fri Nov 29, 2013 8:26 pm
Contact:

Re: About Question enthuware.oce-ejbd.v6.2.389 :

Post by himaiMinh »

On p.82 of JSR-318
By default, clients are allowed to make concurrent calls to a stateful session object and the container is required to serialize such concurrent request....
That means two clients can call a method of a stateful bean. And the container will handle one client call at a time, (ie, one call after another call).

So, in this specific scenario, there is only one stateful bean and only one interceptor instance associated with that bean.

admin
Site Admin
Posts: 10036
Joined: Fri Sep 10, 2010 9:26 pm
Contact:

Re: About Question enthuware.oce-ejbd.v6.2.389 :

Post by admin »

You are misinterpreting the specification. The statement that you have quoted is talking about a client making multiple concurrent calls on the same bean. Two different clients cannot use the same stateful bean. Two different clients will get two references to two different instances of the bean. If the container uses the same stateful bean instance for the two clients, the state of the bean will be messed up. For example, if one client calls method m1, another clients calls m1, and them first client calls m2, then the first client will expect the state of the bean based on its initial call to m1 but that has been messed up by another clients call to m2.
If you like our products and services, please help us by posting your review here.

Post Reply

Who is online

Users browsing this forum: No registered users and 29 guests