Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Question about passing local & remote reference

 
Will Lee
Ranch Hand
Posts: 58
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'm using "SCBCD Exam study kit". The mock question 8 of Ch3:

Assuming L & R are the local and remote clients for session bean B, which of the following are true?
a. L can pass its reference for B as a return value of a method call from R
b. R can pass its reference for B as a parameter in a method call to L
c. L cannot call methods on R
d. L cannot call methods on B

The answer is b & c.

Why C?
 
srikanthD reddy
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi frnds,
Can nyone please explain me about options 1 and 2 ??

thanks a lot ..

thanks
sri
 
Ramakrishnan Ponmudi
Ranch Hand
Posts: 72
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
i believe these answers are correct, correct me if wrong
c)L cannot call methods on R - true
bcz, both are extending different interfaces(EJBObject, EJBLocalObject)

d) L cannot call methods on B -- false
B's Local Interface and L are extends from same interface EJBLocalObject
so L can call methods on B

EJBObject, EJBLocalObject these two terms are used in general,
in specific these are like Order, OrderLocal
 
srikanthD reddy
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I suppose here L and R represent the local and remote client and they dont extend any interfaces(component interfaces(local and remote) extends the EJBLocalObject and EJBObject respectively))...
i donot get the options 1 and 2...
please do help...

thanks
sri
 
Will Lee
Ranch Hand
Posts: 58
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Will Lee:

a. L can pass its reference for B as a return value of a method call from R
b. R can pass its reference for B as a parameter in a method call to L


Local interface can only stay locally, it can not be passed outside of JVM. Therefore,
A. L's reference for B is actually a reference to EJBLocalObject of B (stub), in order to pass to R as return value, it probably need to go to another JVM where R is sitting at. So A is wrong

B. R's reference for B is actually a reference to EJBObject of B (stub), since it's remote interface type, it can go anywhere, w/in or outside of JVM. When it is passed as parameter to L, it just goes to another JVM which is perfectly OK, therefore B is correct

I just can't get the reason of C: why local client can not call remote client's methods? Remote client doesn't have anything to do w/ remote interface type, even it is in another location, L should be able to RMI it. Why "can NOT"?
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic