• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Question on java.rmi.PortableRemoteObject

 
Joe Harry
Ranch Hand
Posts: 10124
3
Eclipse IDE Mac PPC Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Why do we use the narrow() method of the PortableRemoteObject when accessing RemoteObjects? Is this a dependency on the protocol (IIOP, CORBA) for Remote access?
 
Jeanne Boyarsky
author & internet detective
Marshal
Posts: 34860
369
Eclipse IDE Java VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Jothi,
You hit it right on the head. The returned object has links to CORBA/IIOP. Calling narrow() gives you an object that is safe to use locally and can be cast to your interface type.
 
Joe Harry
Ranch Hand
Posts: 10124
3
Eclipse IDE Mac PPC Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks Jeanne but can you please elaborate a bit on it?
 
Jeanne Boyarsky
author & internet detective
Marshal
Posts: 34860
369
Eclipse IDE Java VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Jothi,
A couple years ago I was curious and set my debugger to the line of PortableRemoteObject.narrow() in my code and looked at the fields in the object. I saw a bunch of networking related stuff. I don't recall exactly what is in there anymore so it's hard to elaborate. You could try the same experiment if you are really curious.
 
Joe Harry
Ranch Hand
Posts: 10124
3
Eclipse IDE Mac PPC Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Jeanne, thanks for the hint. I just want to ask you one more thing is that did you ever come across a line that talks about this in the Head First EJB? If yes could you please tell me which page is that?
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic