aspose file tools*
The moose likes EJB Certification (SCBCD/OCPJBCD) and the fly likes Question Reg parameter Passing - HFEJB Pg No 170 Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Certification » EJB Certification (SCBCD/OCPJBCD)
Bookmark "Question Reg parameter Passing - HFEJB Pg No 170" Watch "Question Reg parameter Passing - HFEJB Pg No 170" New topic
Author

Question Reg parameter Passing - HFEJB Pg No 170

Natarajan Shankar
Ranch Hand

Joined: Jun 10, 2004
Posts: 53
Givn Remote client 'R' that has valid reference to session bean 'A' and 'B', and given that 'A' is local client to 'B', which statement are true. (Choose all that apply)

A. R Cannot passs his reference for A, to B.

B. A Cannot pass his reference for B, to R.

C. A Cannot invoke method of B.

D. B cannot invoke method on R.

{Correct answer give was B and D.}

Can you pls. explain why A is not valid and B is valid.
My assumption is R is in one heap and Sesson bean A,B are in another heap. So R will not pass reference it can pass only reference copy.


Best Regards<br />N.Shankar<br />SCJP, SCWCD
Amitava Basu
Greenhorn

Joined: May 11, 2004
Posts: 4
Hi,

You are correct, R is in a different heap than A & B. R's reference to A is nothing but a Stub.
Hence in side code, when R passes a reference of A to anybody it is actually passing the copy of the stub. And that is OK.
If R passes a copy of A's stub to B, then B can call methods or do other stuff on A as an remote object (though they are in the same heap).
Option (A) says that R Can not pass a reference of A to B (if fact it can) hence A is not correct.

Option (B) says that A can not pass it’s reference for B to R, yes it can not. Because A & B are LOCAL and they are not dealing with stubs they are dealing with actual references. Those references do not have any value to R being in a separate heap. Hence B is correct.

Let me know if you have any different opinion.
Natarajan Shankar
Ranch Hand

Joined: Jun 10, 2004
Posts: 53
Hi Amitava Basu,
Thanks for your clarificatio.

when R passes a reference of A to anybody it is actually passing the copy of the stub.
And that is OK.


The above clarification you have given was the point I was missing in my understanding, when R passes a reference of A I was assuming the actual object reference. Thanks for you clarification. BTW, this solution will satisfy if we're assuiming this one.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Question Reg parameter Passing - HFEJB Pg No 170
 
Similar Threads
Head First EJB,Chapter-3,COFFEE CRAM-MOCK EXAM
A question about the client view
EJB can local bean invoke business methods on remote interface passed from other JVM?
Head First EJB-CH-3-Mock Exam Query
Remote and Local Interfaces