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

Why we are using Portable Remote Object.narrow()?

 
Praveen Joe
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Why we are using Portable Remote Object .narrow()instead of normal java casting ?
 
Ugender Rekulampally
Ranch Hand
Posts: 135
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Praveen,

For local clients, we don't have to use PortableRemoteObject.narrow() but still using PortableRemoteObject is suggested/recommended or may be you can say a must.

But for remote clients you have to use PortableRemoteObject. No other options. the reason is, the stub that client has uses IIOP to connect to the Container to get the actual home object to call a create method on it to get the Component Interface reference.

So in a word, you are using IIOP protocal so you have to use PortableRemoteObject.

I am sure the explanation is not great but please read HFEJB for better understanding on this.


Thanks,
Ugender
 
Michael Valentino
Ranch Hand
Posts: 96
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Just thought I'd add that using PortableRemoteObject.narrow() is not necessary for local clients. In fact, it shouldn't be used because with a local client, you will ALWAYS be running in the same JVM, so no remote protocol is used, ever. Therefore, the call to narrow() introduces unnecessary overhead. Why run a method to do what a simple cast will accomplish?
 
Ugender Rekulampally
Ranch Hand
Posts: 135
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Michael,
Goodluck for your exam. I saw your test as 6/9/06 besides your SCBCD so ..

Ugender
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic