Win a copy of The Java Performance Companion this week in the Performance forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Local client view contract -doubt

 
Siva Masilamani
Ranch Hand
Posts: 385
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi

I am preparing for SCBCD and was going through the specification.

I did not understand the point at the Local client view contract.

the Bean Provider must be careful that the state of one enterprise bean is not assigned as
the state of another. In general, the references that are passed across the local interface cannot be used
outside of the immediate call chain and must never be stored as part of the state of another enterprise
bean.


Could somebody please explain me what they are trying to tell at this point?.


I know that in case of local interface the object we passed is shared by both caller and callee...

But why we should not store the state of one ejb in to the state of other?

What do they mean by 'the references that are passed across the local interface cannot be used
outside of the immediate call chain " and which reference are they talking about?
 
Davide Crudo
Ranch Hand
Posts: 62
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I believe you are referring to Stateless Session beans...right?

I was reading a while back that one of the differences between the local and remote interface is how to handle method calls.

For instance, in local interfaces, when you call a method passing another object as a parameter, you pass the reference of the object,
when you use remote interfaces, you pass the object as a value (i.e. a copy of the object)

Since Stateless beans are taken from the pool and then released, i think what they are trying to say, is that you should not take
the reference of the bean you are using and passing it to another object to use that reference later.

You can use it, however, during the immediate call chain, which i believe it means that you can use it, while the called method is running...
so, if you call a method, that call another method, you should be ok to pass to the second method, the reference of the stateless bean, but
this should last only for the current call. Subsequent calls should not refer to the previous Stateless bean...

This is just my interpretation...sometimes i find Specifications kind of cryptic ;)

Dave
 
Siva Masilamani
Ranch Hand
Posts: 385
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yea...i got this point now..

thanks.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic