This week's book giveaway is in the JavaScript forum.
We're giving away four copies of Cross-Platform Desktop Applications: Using Node, Electron, and NW.js and have Paul Jensen on-line!
See this thread for details.
Win a copy of Cross-Platform Desktop Applications: Using Node, Electron, and NW.js this week in the JavaScript forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

using protable remote object's narrow  RSS feed

 
krishna prasad gunasekaran
Ranch Hand
Posts: 158
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
why use javax.rmi.PortableRemoteObject.narrow(narrowFrom, narrowTo) instead of java casting?
 
Vijitha Kumara
Bartender
Posts: 3992
27
Chrome Fedora Hibernate
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
javax.rmi.PortableRemoteObject.narrow is needed, if you are using EJB's (for example) since it uses RMI-IIOP as the underlying protocol for the communication.

Regards,
 
krishna prasad gunasekaran
Ranch Hand
Posts: 158
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
only when the underlying protocol is RMI-IIOP? because i used direct java cast and it worked...
then, how to find the underlying protocol?
 
satish bodas
Ranch Hand
Posts: 116
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
the ejb container could use rmi OR rmi-iiop

In case of rmi a simple cast would work - but if the container were to implement rmi-iiop - then a simple cast will not work

If youu use the code with a simple cast - then there is a possibility that on some containers this code will fail

To make the code portable across servers irresepctive of whether they use rmi OR rmi-iiop you should use the "narrow" method to get Home Object.

Thanks ~satish
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!