• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

PortableRemoteObject.narrow

 
Saurabh Chaubey
Ranch Hand
Posts: 101
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Can anyone explain me in detail the need to do PortableRemoteObject.narrow() for getting the Home Object Stub.

Regards,
Saurabh
 
Herman Schelti
Ranch Hand
Posts: 387
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi Saurabh Chaubey,

according to the specs:
(5.4) Narrowing remote types requires the use of javax.rmi.PortableRemoteObject.narrow rather than Java language casts.

(6.10) Note: Programs using the cast operator for narrowing the remote and remote home interfaces are likely
to fail if the Container implementation uses RMI-IIOP as the underlying communication transport.

To me that's detail enough...

Herman
 
Vinay Raj
Ranch Hand
Posts: 81
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I believe this link gives a more lucid explanation.
 
Saurabh Chaubey
Ranch Hand
Posts: 101
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks Herman and Vinay for your response.

Regards,
Saurabh
 
Cameron Wallace McKenzie
author and cow tipper
Saloon Keeper
Posts: 4968
1
Hibernate Spring Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
My understanding, and this was more of an explaination that made me happy, as opposed to one that may be technically correct, is that the object that gets returned could potentially have a whole whack of CORBA baggage related to it, especially if it comes from a different vendors EJB container. The narrow forces the returned object through a bit of a baggage screening process, removes any sharp items, and returns a clean, handsome object for your Java programs to work with.
 
Jeroen T Wenting
Ranch Hand
Posts: 1847
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Pretty much. In fact what's returned is a complete CORBA stub which needs to be turned into a Java class instance before it's any good to the JVM.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic