Help coderanch get a
new server
by contributing to the fundraiser
  • 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()

 
Greenhorn
Posts: 24
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,

I didnt quite get y we call this on the object returned from the JNDI.
Can some one please explain ??

Thanks in advance.
 
Ranch Hand
Posts: 884
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Kituz Pathangi:
Hi,

I didnt quite get y we call this on the object returned from the JNDI.
Can some one please explain ??

Thanks in advance.



In short, so that we can be sure that the object we're getting is the home interface. Reason being the protocol could be CORBA-IIOP instead of JRMP. There is no performance issue in using this method. It doesn't make your code slower or uses more resources, does you more good than harm in using it.
 
Ranch Hand
Posts: 250
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,
You need to narrow because your container may be using RMI-IIOP and the retured object is not guranteed to be something that implements your home interface. By narrowing you are just making sure that whatever you are getting does implement the home interface.

Hope that helps.

Sawan
 
Alas, poor Yorick, he knew this tiny ad:
We need your help - Coderanch server fundraiser
https://coderanch.com/t/782867/Coderanch-server-fundraiser
reply
    Bookmark Topic Watch Topic
  • New Topic