• 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: 3972
24
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
 
Don't get me started about those stupid light bulbs.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!