Win a copy of Practical SVG this week in the HTML/CSS/JavaScript forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Why PortableRemoteObject.narrow() for handle ?

 
Rahul Bhattacharjee
Ranch Hand
Posts: 2308
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It's understandable that for converting the stub got from JNDI server we need to do PortableRemoreObject.narror() as because the wire protocol may be IIOP , might not be JRMP.

I got the following from the sun ejb spec.



I am failing as while deserializing why do we need to do a cast using PortableRemoteObject.narrow() , a simple java cast should be enough for this case as no wire protocol is involved.
A normal serialization should be fine.
 
Nitesh Kant
Bartender
Posts: 1638
IntelliJ IDE Java MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Rahul, worth noting that the "narrow"ing is done for the EjbObject returned from .
It totally depends on the implementation of the handle as to how it retrieves the EjbObject which may include a lookup of the same from the remote server.
 
Rahul Bhattacharjee
Ranch Hand
Posts: 2308
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Nitesh Kant:

It totally depends on the implementation of the handle as to how it retrieves the EjbObject which may include a lookup of the same from the remote server.


That's true that it depends on the container as how to implement this , but if the container chooses to implement it that way then within the method itself it should do narrowing and return a EJBObject to the caller.The client / caller should be unaware of if any wire communication is happening with the server using IIOP.
 
Nitesh Kant
Bartender
Posts: 1638
IntelliJ IDE Java MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Good point rahul.
I am not really sure as to why the ejb specs choose not to do the same, but what i can think of is more from a consistency angle more than anything else.
It is suggested that whenever a client gets a home/remote interface implementation reference, it should use narrowing to interoperate with servers using IIOP as the transport protocol.
May be someone else will be able to comment on it..
However, i think it is clear that narrow is not required for a de-serialized handle. It is only required for the EjbObject obtained from the handle.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!