• 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
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Question about passing local & remote reference

 
Ranch Hand
Posts: 58
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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?
 
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi frnds,
Can nyone please explain me about options 1 and 2 ??

thanks a lot ..

thanks
sri
 
Ranch Hand
Posts: 72
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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"?
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic