• 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

PortableRemoteObject.narrow

 
Ranch Hand
Posts: 101
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Ranch Hand
Posts: 387
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Ranch Hand
Posts: 81
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks Herman and Vinay for your response.

Regards,
Saurabh
 
author and cow tipper
Posts: 5009
1
Hibernate Spring Tomcat Server
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Ranch Hand
Posts: 1847
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic