This week's book giveaway is in the OO, Patterns, UML and Refactoring forum. We're giving away four copies of Refactoring for Software Design Smells: Managing Technical Debt and have Girish Suryanarayana, Ganesh Samarthyam & Tushar Sharma on-line! See this thread for details.
When the EJB 2.1 and earlier remote home and remote component interfaces are used, the narrowing of remote types requires the use of javax.rmi.PortableRemoteObject.narrow rather than Java language casts.
Now I have many queries related to this
What i have understood in RMI is that when you do lookup you get a STUB(which takes care of all the n/w complexities) and not an actual implementation.
So when you register your business object eg "abcInstance" ,the container will actually register a stub object which the client will later do lookup ,
( i assume that the container might have followed this procedure to create a STUB )
a) It will first see which business interface this instance is implementing.
b) And then create a stub which has all the method implemented of the interface.
So that means it is not necessary that the STUB and the actual implementation be always SAME ! because the stub is having only those methods which are mentioned in the interface,while the actual
implementation class might have more methods
So now my Question to everyone is that it does not make sense for a client to actually do narrowing.
Because when he does lookup he receives a stub instance which he stores in Business interface reference, so when he narrow's ,he'll narrow down to stub which has same methods which are there in the interface
so does not make sense to actually narrow down.
Can someone put light on this and correct me if i have got wrong somewhere.
My above explanation can be totally wrong if the container creates a STUB base on the actual implementation class rather then the interface.So can someone confirm what actually happens ??
Q2) the above quote of spec has mentioned narrowing information about EJB 2.x.What about EJB 3.x .I dint found it mentioned anywhere ???